🚀 Top 20 QA Automation Interview Questions with Answers (Selenium, Playwright, Cypress)
If you’re preparing for a QA Automation Engineer Interview at companies like Deloitte, Accenture, Infosys, TCS, or product-based firms, then you must be ready to answer tool-agnostic automation questions.
This blog covers the 20 most frequently asked QA Automation Interview Questions with detailed explanations and examples in Selenium, Playwright, and Cypress.
1. Tell me about yourself
💡 Keep it professional, focus on automation skills.
✅ Example:
"I’m a QA Automation Engineer with experience in Selenium, Playwright, and Cypress. I’ve built frameworks from scratch, applied OOPs concepts, handled CI/CD pipelines in Jenkins, and worked on cross-browser, regression, and API testing."
2. Find XPath of the search bar on an eCommerce site
✅ Example (Amazon search bar):
//input[@id='twotabsearchtextbox']
3. What types of locators do you use in your project?
- ID, Name, ClassName, XPath, CSS, LinkText (Selenium)
- CSS/XPath selectors (Playwright, Cypress)
Example – Enter username:
Selenium (Java):
driver.findElement(By.id("username")).sendKeys("admin");
Playwright (JS/TS):
await page.fill('#username', 'admin');
Cypress (JS):
cy.get('#username').type('admin');
4. Have you used CSS Selectors?
✅ Example – Enter email:
Selenium:
driver.findElement(By.cssSelector("input#email")).sendKeys("test@gmail.com");
Playwright:
await page.fill('input#email', 'test@gmail.com');
Cypress:
cy.get('input#email').type('test@gmail.com');
5. Types of XPath you’re familiar with?
- Absolute XPath: /html/body/div/input
- Relative XPath: //input[@name='q']
6. Difference between Background and Scenario Outline in Cucumber.
- Background: Common steps for all scenarios.
- Scenario Outline: Data-driven testing with Examples.
7. How have you applied OOPs concepts in Cucumber?
- Encapsulation → Page Object Model
- Inheritance → Base Test Classes
- Polymorphism → Method Overloading
✅ Example – Login Method
Selenium (POM in Java):
public class LoginPage {
WebDriver driver;
@FindBy(id="username") WebElement user;
@FindBy(id="password") WebElement pass;
public void login(String u, String p) {
user.sendKeys(u);
pass.sendKeys(p);
}
}
Playwright (JS):
class LoginPage {
constructor(page) { this.page = page; }
async login(username, password) {
await this.page.fill('#username', username);
await this.page.fill('#password', password);
}
}
Cypress:
class LoginPage {
login(username, password) {
cy.get('#username').type(username);
cy.get('#password').type(password);
}
}
8. Java Program: Remove spaces & reverse a string
Java:
String str = "This is a Java Program";
str = str.replaceAll("\\s", "");
String reversed = new StringBuilder(str).reverse().toString();
System.out.println(reversed);
(Playwright & Cypress not needed here since this is Java-focused question.)
9. Explain SDLC briefly
- Requirement Analysis
- Design
- Development
- Testing
- Deployment
- Maintenance
10. In TestNG, how do you prioritize methods?
Selenium with TestNG:
@Test(priority=1) public void loginTest() {}
@Test(priority=2) public void addToCartTest() {}
👉 If priorities are same, execution is alphabetical.
11. List exceptions in Selenium
- NoSuchElementException
- StaleElementReferenceException
- TimeoutException
12. How do you handle exceptions?
Selenium:
try {
driver.findElement(By.id("btn")).click();
} catch(NoSuchElementException e) {
System.out.println("Element not found!");
}
Playwright:
try {
await page.click('#btn');
} catch (e) {
console.log("Element not found!");
}
Cypress:
Cypress.on('uncaught:exception', (err, runnable) => {
return false; // ignore errors
});
13. How to handle pop-ups/alerts?
Selenium:
Alert alert = driver.switchTo().alert();
alert.accept();
Playwright:
page.on('dialog', dialog => dialog.accept());
Cypress:
cy.on('window:alert', (txt) => {
expect(txt).to.contains('Success');
});
14. Walk through framework folder structure
✅ Example (Maven + BDD):
src/test/java → Test scripts
src/main/java → Utilities, Page Objects
src/test/resources → Feature files
pom.xml → Dependencies
15. Role of pom.xml in Maven
- Dependency Management
- Build lifecycle
- Plugins
16. Cross-browser testing
Selenium:
if(browser.equals("chrome")) driver = new ChromeDriver();
else if(browser.equals("firefox")) driver = new FirefoxDriver();
Playwright:
const { chromium, firefox } = require('playwright');
const browser = await firefox.launch();
Cypress:
npx cypress run --browser chrome
npx cypress run --browser firefox
17. Types of testing you worked on
Smoke, Regression, Integration, API, UAT
18. Difference between Smoke vs Regression
- Smoke = Build Verification
- Regression = Ensures old features work after changes
19. Java Collections usage
Selenium (Java):
List<String> items = new ArrayList<>();
items.add("Laptop");
Playwright (JS):
let items = ["Laptop", "Mobile"];
items.forEach(i => console.log(i));
Cypress:
const items = ["Laptop", "Mobile"];
items.forEach(i => cy.log(i));
20. Have you created a framework from scratch?
💡 Answer Flow:
- Chose tool (Selenium / Playwright / Cypress)
- Added dependency management (Maven/npm)
- Implemented Page Object Model
- Configured reporting (Extent/Allure)
- Integrated CI/CD pipeline
📌 Final Words
These 20 QA Automation Interview Questions with answers in Selenium, Playwright, and Cypress cover real-world scenarios that hiring managers love to ask.
👉 Pro Tip: Don’t just memorize — practice hands-on with all three tools so you can adapt to any company’s stack.