Entry-Level Automation Testing
Interview Preparation (Java + Selenium)
Core Java Basics
What are the main OOP concepts in Java?
1. Encapsulation
2. Inheritance
3. Polymorphism
4. Abstraction
What is the difference between ArrayList and LinkedList?
- ArrayList: Fast for read operations, uses dynamic arrays.
- LinkedList: Better for insert/delete operations, uses nodes.
What is the difference between == and .equals()?
- ==: Compares references (memory locations).
- .equals(): Compares object content/values.
What are access modifiers in Java?
- private: Accessible within the class only.
- default: Accessible within the same package.
- protected: Accessible within package and subclasses.
- public: Accessible everywhere.
Selenium Basics
What is Selenium?
Selenium is an open-source tool for automating web applications.
What are the different components of Selenium?
1. Selenium IDE
2. Selenium WebDriver
3. Selenium Grid
How do you launch a browser in Selenium WebDriver?
WebDriver driver = new ChromeDriver();
driver.get("https://example.com");
What are locators in Selenium?
Locators help identify elements. Types:
- ID
- Name
- ClassName
- TagName
- LinkText / PartialLinkText
- XPath
- CSS Selector
What is the difference between findElement() and findElements()?
- findElement(): Returns a single WebElement. Throws exception if not found.
- findElements(): Returns a list. Returns empty list if not found.
Test Automation Framework Basics
What is a Test Automation Framework?
A structured way to automate test scripts for maintainability and reusability. Examples:
Data-Driven, Keyword-Driven, Hybrid.
What is TestNG?
A testing framework used with Selenium to manage test cases, annotations, assertions, and
reports.
Common TestNG Annotations:
- @BeforeMethod
- @AfterMethod
- @Test
- @BeforeClass
- @AfterClass
Sample Coding Questions
Write a Java program to check if a string is a palindrome.
public class Palindrome {
public static void main(String[] args) {
String str = "madam";
String rev = new StringBuilder(str).reverse().toString();
if (str.equals(rev)) {
System.out.println("Palindrome");
} else {
System.out.println("Not a Palindrome");
}
}
}
How do you handle dropdowns in Selenium?
Select dropdown = new Select(driver.findElement(By.id("dropdownId")));
dropdown.selectByVisibleText("Option");
Practical Selenium Scenario
Automate login to a web page.
WebDriver driver = new ChromeDriver();
driver.get("https://example.com/login");
driver.findElement(By.id("username")).sendKeys("user");
driver.findElement(By.id("password")).sendKeys("pass");
driver.findElement(By.id("loginButton")).click();
HR/Behavioral Questions
Tell me about yourself.
Tip: Briefly cover your background, academic history, skills, and enthusiasm for automation
testing.
Why do you want to work in automation testing?
Answer: I enjoy problem-solving and using tools to improve testing efficiency. Automation
helps deliver better software faster.
What are your strengths and weaknesses?
Tip: Strengths like attention to detail, learning mindset. Weaknesses should be real but with
improvement actions.
Final Tips
- Practice coding on platforms like LeetCode or HackerRank.
- Learn basic Git commands.
- Understand Agile and SDLC basics.
- Practice writing test cases and bug reports.