SoftwareTestPilot
30 Mid-Level Q&A

Selenium Interview Questions for 3 Years Experience (1970) — Mid-Level SDET Edition

The exact 30-question set for mid-level SDET interviews in 2026. Architecture, debugging, and production-quality thinking — not fresher trivia. Each answer is written by senior SDETs with Java + TestNG code samples.

  • 4 min read
  • Difficulty: Intermediate → Hard
  • 3–5 yrs
  • Updated June 1970
  • Avinash Kamble

1. Selenium 4 Architecture & Features

Easy Very Common 1 min read

Q1.Explain the Selenium 4 architecture.

Selenium 4 speaks the W3C WebDriver protocol natively (no JSON Wire Protocol). It includes Selenium Manager (auto-driver resolution), Chrome DevTools Protocol access, relative locators, and a fully-distributed Grid model. See our Selenium WebDriver Guide for the full architecture.

Medium Very Common 1 min read

Q2.What is Selenium Manager?

Selenium Manager (Selenium 4.6+) automatically detects the installed browser version and downloads the matching driver. You no longer need WebDriverManager. Just instantiate the driver:

WebDriver driver = new ChromeDriver();
Medium Very Common 1 min read

Q3.What are relative locators?

Selenium 4 introduced position-based locators (above, below, toLeftOf, toRightOf, near):

import static org.openqa.selenium.support.locators.RelativeLocator.with;

WebElement password = driver.findElement(
    RelativeLocator.with(By.tagName("input")).below(emailField)
);
Medium Very Common 1 min read

Q4.How do you access Chrome DevTools Protocol in Selenium 4?

Selenium 4 exposes CDP for network interception, geolocation overrides, performance metrics and more:

ChromeDriver driver = new ChromeDriver();
driver.devTools.createSession();

// Capture network traffic
driver.devTools.send(Network.enable());

// Override geolocation
driver.devTools.send(Emulation.setGeolocationOverride(
    Optional.of(37.7749), Optional.of(-122.4194), Optional.of(100.0)
));
Confidence check

If you can confidently answer the Selenium 4 Architecture & Features questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

2. Waits & Synchronization

Easy Very Common 1 min read

Q5.What's the difference between implicit and explicit waits?

  • Implicit wait: polls the DOM for N seconds on every element lookup.
  • Explicit wait: waits for a specific condition on a specific element.

Best practice in 2026: avoid implicit waits, use only explicit waits.

Medium Very Common 1 min read

Q6.What is fluent wait?

Fluent wait is an explicit wait with a custom polling interval and a list of exceptions to ignore:

FluentWait<WebDriver> wait = new FluentWait<>(driver)
    .withTimeout(Duration.ofSeconds(15))
    .pollingEvery(Duration.ofMillis(500))
    .ignoring(NoSuchElementException.class);
Medium Very Common 1 min read

Q7.How do you handle stale element exceptions?

  • Re-locate the element after the DOM change.
  • Use explicit waits to wait for the new element.
  • Use try/catch with retry logic for known flaky interactions.
Confidence check

If you can confidently answer the Waits & Synchronization questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

3. Page Object Model & Framework Design

Easy Very Common 1 min read

Q8.Explain the Page Object Model.

Each page is a class with locators as private fields and actions as public methods. Tests interact with page objects, never raw locators. Benefits: maintainability, readability, parallel authoring of tests and locators.

For the full POM pattern, see our Selenium WebDriver Guide.

Medium Very Common 1 min read

Q9.What is the Page Factory?

A deprecated-but-still-common pattern that initializes Page Object elements using @FindBy annotations. Modern codebases prefer constructor-based POM without Page Factory.

Confidence check

If you can confidently answer the Page Object Model & Framework Design questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

4. Parallel Execution & Selenium Grid

Medium Very Common 1 min read

Q10.How do you run tests in parallel?

Three approaches:

  • TestNG parallel mode: parallel="methods" thread-count="4" in testng.xml.
  • Selenium Grid: Hub + nodes on multiple machines.
  • Cloud grid: BrowserStack, Sauce Labs, LambdaTest.
Easy Very Common 1 min read

Q11.Explain Selenium Grid architecture.

Grid has two components:

  • Hub: receives test requests, distributes to nodes.
  • Nodes: execute tests in registered browser/OS combos.

In Selenium 4, the Grid is fully distributed (no standalone hub-and-node model).

Medium Common 1 min read

Q12.How do you set up Selenium Grid with Docker?

# docker-compose.yml
version: '3'
services:
  chrome:
    image: selenium/node-chrome:4.25
    shm_size: 2gb
    depends_on: [hub]
  hub:
    image: selenium/hub:4.25
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
Confidence check

If you can confidently answer the Parallel Execution & Selenium Grid questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

5. Reliability, Reporting & CI/CD

Medium Common 1 min read

Q13.How do you handle flaky tests?

  • Use explicit waits (not Thread.sleep).
  • Isolate test data per test.
  • Design for parallelism from day one.
  • Use retry only as a last resort, with quarantining and dashboards.
Medium Common 1 min read

Q14.How do you take a screenshot on failure?

@AfterMethod
public void tearDown(ITestResult result) {
    if (result.getStatus() == ITestResult.FAILURE) {
        TakesScreenshot ts = (TakesScreenshot) driver;
        File src = ts.getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(src, new File("screenshots/" + result.getName() + ".png"));
    }
    driver.quit();
}
Medium Common 1 min read

Q15.How do you integrate Selenium with CI/CD?

A minimal GitHub Actions job:

- uses: actions/setup-java@v4
  with: { distribution: temurin, java-version: '17' }
- run: mvn -B test

See GitHub Actions + Selenium CI for the full pipeline.

Medium Common 1 min read

Q16.How do you test in headless mode?

ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");
WebDriver driver = new ChromeDriver(options);
Confidence check

If you can confidently answer the Reliability, Reporting & CI/CD questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

6. Real-World Scenarios

Easy Common 1 min read

Q17.How do you handle authentication (login) in tests?

  • Use cookies: log in once, save cookies, reuse in tests.
  • Use API-based login: hit the auth API, capture the token, inject as a cookie.
  • Use a dedicated test user.
Medium Common 1 min read

Q18.How do you run tests on multiple browsers?

Use TestNG parameters and a @BeforeMethod that reads the browser from config:

@Parameters("browser")
@BeforeMethod
public void setUp(String browser) {
    if (browser.equals("chrome")) driver = new ChromeDriver();
    else if (browser.equals("firefox")) driver = new FirefoxDriver();
}
Medium Common 1 min read

Q19.How do you handle file uploads?

driver.findElement(By.id("upload")).sendKeys("/path/to/file.png");
Medium Common 1 min read

Q20.How do you handle file downloads?

Configure Chrome to download to a specific directory without showing the dialog:

ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<>();
prefs.put("download.default_directory", "/tmp/downloads");
options.setExperimentalOption("prefs", prefs);
Medium Common 1 min read

Q21.How do you handle iframes?

driver.switchTo().frame("iframe-name");
driver.findElement(By.id("inside-iframe")).click();
driver.switchTo().defaultContent();
Medium Common 1 min read

Q22.How do you handle alerts/popups?

Alert alert = driver.switchTo().alert();
alert.accept();  // OK
alert.dismiss(); // Cancel
Medium Occasional 1 min read

Q23.How do you execute JavaScript in Selenium?

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollTo(0, document.body.scrollHeight)");
Confidence check

If you can confidently answer the Real-World Scenarios questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

7. TestNG Deep Dive

Easy Occasional 1 min read

Q24.What is TestNG and why use it over JUnit?

TestNG has data providers, listeners, and dependency-based ordering built-in. JUnit 5 has similar features via extensions but with different syntax. See our Java for Selenium guide for the full comparison.

Medium Occasional 1 min read

Q25.How do you use TestNG data providers?

@DataProvider(name = "users")
public Object[][] users() {
    return new Object[][] {
        {"admin@example.com", "Sup3rSecret!"},
        {"viewer@example.com", "ViewerPass1!"}
    };
}

@Test(dataProvider = "users")
public void loginTest(String email, String password) { ... }
Medium Occasional 1 min read

Q26.How do you use TestNG listeners?

public class MyListener implements ITestListener {
    @Override
    public void onTestFailure(ITestResult result) {
        // Take screenshot, log failure
    }
}

Register in testng.xml:

<listeners>
    <listener class-name="com.qa.MyListener"/>
</listeners>
Confidence check

If you can confidently answer the TestNG Deep Dive questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

8. Project Setup, Data & Strategy

Medium Occasional 1 min read

Q27.How do you configure a Selenium project with Maven?

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.25.0</version>
</dependency>
Easy Occasional 1 min read

Q28.What's the best practice for test data management?

  • Use external files (JSON, CSV, Excel).
  • Use a database fixture for complex data.
  • Generate random data with libraries like Java Faker.
  • Never hardcode credentials.
Easy Occasional 1 min read

Q29.How do you measure test coverage?

  • Code coverage: JaCoCo (Java), Istanbul (JS), Coverage.py (Python).
  • Requirement coverage: traceability matrix in TestRail or Xray.
  • Risk coverage: identify high-risk areas and ensure 100% test coverage.
Easy Occasional 1 min read

Q30.How do you sell the value of Selenium automation to leadership?

  • Quantify time saved (manual regression was 3 days, now 4 hours).
  • Show defect escape rate reduction (from 8% to 1.5%).
  • Show cycle time improvement (PR cycle from 48h to 14h).
  • Show cost avoidance (one prevented P0 bug = $50k+ saved).

For the full interview prep, see our Software Testing Interview Questions Master List.

Confidence check

If you can confidently answer the Project Setup, Data & Strategy questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

Quick revision

  1. Q1: Explain the Selenium 4 architecture. — Selenium 4 speaks the W3C WebDriver protocol natively (no JSON Wire Protocol).
  2. Q2: What is Selenium Manager — Selenium Manager (Selenium 4.6+) automatically detects the installed browser version and downloads the matching driver.
  3. Q3: What are relative locators — Selenium 4 introduced position-based locators ( above , below , toLeftOf , toRightOf , near ): import static org.openqa.selenium.support.locators.RelativeLocator.with; WebElement p
  4. Q4: How do you access Chrome DevTools Protocol in Selenium 4 — Selenium 4 exposes CDP for network interception, geolocation overrides, performance metrics and more: ChromeDriver driver = new ChromeDriver(); driver.devTools.createSession(); //
  5. Q5: What's the difference between implicit and explicit waits — Implicit wait: polls the DOM for N seconds on every element lookup.

Frequently asked questions

US: $110k–$140k. India: ₹10L–₹18L. UK: £55k–£75k. See our QA Salary Guide for the full breakdown.

Both. Selenium for enterprise breadth. Playwright for modern greenfield. Most 2026 interviews cover both.

'How do you handle flaky tests?' — interviewers want to know you understand root causes and prevention, not just retry-on-failure.

Was this article helpful?

Key takeaways

  • Master the fundamentals before tackling advanced Selenium (3 yrs) scenarios.
  • Always explain trade-offs — interviewers reward judgement, not memorisation.
  • Use real project examples; generic answers blend in.
  • Practice answers out loud — written prep doesn't transfer to live rounds.
  • Revise the 30-second cheat sheet the night before your interview.
  • Keep one strong scenario story ready for every section above.
Home