100+ Selenium Interview Questions and Answers (2027)

102 Selenium interview questions with answers: WebDriver, locators, waits, page objects, Grid 4, CI and flaky test scenarios, grouped by experience level.

Sep 27, 2025 - 17:23
Nov 5, 2026 - 23:49
 0  121
100+ Selenium Interview Questions and Answers (2027)

Selenium interview questions check whether you can drive real browsers with WebDriver, pick stable locators, synchronise with explicit waits, structure tests with page objects and run them at scale on Selenium Grid inside a CI pipeline. This page has 102 numbered questions with direct answers, grouped by experience level, plus ten scenario questions.

It is the broad Selenium question bank on our blog. If you want troubleshooting stories rather than definitions, read the scenario-based Selenium interview questions after this. Both sit under our DevOps interview questions hub.

Key takeaways

  • Freshers are asked about WebDriver, locators, waits, frames, windows and alerts (questions 1 to 35).
  • Mid-level candidates must explain page objects, parallel runs, Grid 4 components and CI integration (questions 36 to 75).
  • Senior candidates are judged on framework design, flakiness metrics and when not to use Selenium (questions 76 to 92).
  • Selenium 4 speaks only the W3C WebDriver protocol, ships Selenium Manager for drivers and is adding WebDriver BiDi APIs.
  • Selenium RC is gone. Answers that rely on it, or on Thread.sleep, mark a candidate as out of date.
  • Scenario questions (93 to 102) expect symptom, cause, fix and prevention in that order.

How the questions are organised

LevelQuestionsWhat to practise
Fresher1 to 35Write a login test with explicit waits in Java or Python
2 to 5 years36 to 75Build a page object suite and run it in parallel on a local Grid in Docker
Senior76 to 92Explain a flakiness dashboard and a migration plan
Scenarios93 to 102Talk through a failure from first symptom to prevention

Freshers: Selenium basics (questions 1 to 35)

1. What is Selenium?

Selenium is an open source project for automating web browsers. Its main parts are WebDriver (a programming interface that drives real browsers), Selenium Grid (runs tests on remote machines in parallel) and Selenium IDE (a browser extension that records and plays back actions). It is used mostly for end-to-end testing of web applications.

2. What are the components of the Selenium project today?

WebDriver, Grid and IDE. Selenium RC (Remote Control) was the original JavaScript-injection approach; it was deprecated when WebDriver arrived and removed from the main distribution with Selenium 3. Any answer that lists RC as a current component is out of date.

3. What is WebDriver and how does it talk to a browser?

WebDriver is a language binding (Java, Python, C#, Ruby, JavaScript and others) that sends commands to a browser driver such as chromedriver or geckodriver. The driver translates them into native browser automation. The protocol is the W3C WebDriver standard, an HTTP and JSON protocol, so every compliant driver accepts the same commands.

4. What is the W3C WebDriver standard and why did it matter for Selenium 4?

It is the W3C Recommendation that defines how clients and browser drivers communicate. Selenium 4 speaks only the W3C protocol, while Selenium 3 still translated the older JSON Wire Protocol. The practical effect is fewer browser-specific quirks and capabilities that follow the standard names, such as browserName and pageLoadStrategy.

5. Which browsers can Selenium automate?

Chrome, Edge, Firefox and Safari have official drivers maintained by the browser vendors (chromedriver, msedgedriver, geckodriver and safaridriver). Internet Explorer support is limited to IE mode in Edge through the IEDriverServer. Chromium-based browsers generally work through chromedriver.

6. What is Selenium Manager?

Selenium Manager is a tool bundled with Selenium since version 4.6 that finds or downloads the right browser driver, and in newer releases the browser itself, when none is on the PATH. It removed the need for third-party driver download libraries in most projects. It runs automatically when you create a driver without a driver path.

7. How do you start a Chrome session in Python?

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)
driver.get("https://example.com")
print(driver.title)
driver.quit()

Selenium Manager locates chromedriver, so no path is needed. Always call quit() in a finally block or fixture teardown so the browser and driver process close.

8. What is the difference between close() and quit()?

close() closes the current window or tab. quit() ends the whole WebDriver session, closes every window and stops the driver process. Forgetting quit() leaves orphaned browser processes on CI agents.

9. What locator strategies does Selenium support?

The By class supports id, name, class name, tag name, link text, partial link text, CSS selector and XPath. Selenium 4 added relative locators (above, below, toLeftOf, toRightOf, near). Under the W3C protocol, id, name and class name are converted to CSS selectors by the client.

10. Which locator should you prefer?

A stable, unique attribute: an id, or a dedicated test attribute such as data-testid used through a CSS selector. CSS is short and fast to read. Use XPath when you need text matching or to move up the DOM. Avoid locators built from generated class names or long absolute paths.

11. What is the difference between absolute and relative XPath?

Absolute XPath starts from the root (/html/body/div[2]/...) and breaks with any layout change. Relative XPath starts with // and anchors on attributes or text, for example //button[normalize-space()='Save']. Relative XPath is the only kind worth keeping in a test suite.

12. Write a CSS selector and an XPath for the same element.

For <input name="email" type="email"> inside a form with id login: CSS #login input[name='email'], XPath //form[@id='login']//input[@name='email']. CSS cannot select by visible text; XPath can, with contains(text(),'...') or normalize-space().

13. What is the difference between findElement and findElements?

findElement returns the first match and throws NoSuchElementException if nothing matches. findElements returns a list, which is empty when nothing matches. Use the list form to check that something is absent without catching an exception.

14. What are relative locators?

Selenium 4 locators that find an element by its position relative to another, for example the input below a label. In Java: driver.findElement(RelativeLocator.with(By.tagName("input")).below(By.id("email-label"))). They use the rendered layout from getBoundingClientRect, so they can misbehave on responsive layouts where elements move.

15. How do you type into a field and click a button?

Find the element and call sendKeys (Java) or send_keys (Python), then click(). Call clear() first if the field may already hold text. Selenium clicks at the centre of the element and raises an error if another element covers that point.

16. How do you read text and attributes from an element?

getText() returns the visible rendered text. getAttribute(name) returns the property or attribute value. Selenium 4 also has getDomAttribute and getDomProperty, which return exactly the HTML attribute or the live JavaScript property without the mixed behaviour of getAttribute.

17. What are isDisplayed, isEnabled and isSelected?

isDisplayed checks visibility, isEnabled checks that a control is not disabled, and isSelected checks checkboxes, radio buttons and options. They are used in assertions and in custom wait conditions.

18. How do you handle a dropdown?

For a native <select>, wrap it in the Select class and call selectByVisibleText, selectByValue or selectByIndex. Custom dropdowns built from divs are not select elements; click to open them and click the option like any other element.

19. What is an implicit wait?

A session-wide timeout that makes every findElement call poll the DOM until the element appears or the timeout passes. It only waits for presence, not visibility or clickability. Many teams set it to zero and use explicit waits instead.

20. What is an explicit wait?

WebDriverWait combined with a condition from ExpectedConditions (Java) or expected_conditions (Python). It waits for one specific condition, such as an element being clickable, and polls every 500 ms by default.

21. Show an explicit wait in Python.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "[data-testid='submit']"))
)
button.click()

22. What is a fluent wait?

A wait where you set the timeout, the polling interval and which exceptions to ignore while polling. In Java it is FluentWait; WebDriverWait is a subclass with sensible defaults. Use it when the default 500 ms polling is too frequent or you need to ignore StaleElementReferenceException.

23. Why should you not mix implicit and explicit waits?

The Selenium documentation warns that combining them can cause unpredictable wait times, because the implicit timeout applies inside each poll of the explicit wait. A 10 second implicit wait inside a 15 second explicit wait can stretch a failing check far past 15 seconds. Pick explicit waits and keep the implicit wait at zero.

24. Why is Thread.sleep a bad idea?

It always waits the full time, so the suite gets slower, and it still fails when the page is slower than the guess. Explicit waits return as soon as the condition is true. A fixed sleep is acceptable only as a short-term diagnostic.

25. How do you take a screenshot?

Call getScreenshotAs(OutputType.FILE) in Java or save_screenshot(path) in Python for the viewport. Selenium 4 can also screenshot a single element. Most frameworks attach a screenshot automatically when a test fails.

26. How do you handle JavaScript alerts?

Switch to the alert with driver.switchTo().alert(), then call accept(), dismiss(), getText() or sendKeys() for prompts. Wait for it with ExpectedConditions.alertIsPresent() because alerts can appear after a delay.

27. How do you work with frames and iframes?

Switch into the frame by index, name or id, or WebElement with switchTo().frame(...), interact, then return with switchTo().defaultContent() or parentFrame(). An element inside an iframe is invisible to locators until you switch.

28. How do you switch between windows and tabs?

Each window has a handle. Read getWindowHandles(), switch with switchTo().window(handle). Selenium 4 adds switchTo().newWindow(WindowType.TAB) to open and switch to a new tab in one call.

29. What are the browser navigation commands?

get(url) loads a page and waits for the load according to the page load strategy. navigate().to(), back(), forward() and refresh() work like the browser buttons.

30. What is headless mode?

Running the browser without a visible window, which suits CI servers. Chrome's current headless mode is enabled with --headless=new in older docs and plain --headless in recent Chrome versions, where the old implementation was split into a separate binary. Firefox uses -headless. Set an explicit window size because the default headless viewport is small.

31. How do you execute JavaScript from a test?

Cast the driver to JavascriptExecutor (Java) or call execute_script (Python). Typical uses are scrolling an element into view or reading a value the page exposes. Do not use it to click elements that a user could not click, because that hides real bugs.

32. How do you scroll a page?

Selenium 4's Actions API has scrollToElement and scrollByAmount for wheel input. Clicking an element also scrolls it into view automatically. JavaScript scrollIntoView() remains a fallback.

33. What is the Actions class used for?

Composite input: hover with moveToElement, drag and drop, double-click, right-click with contextClick, key combinations with keyDown/keyUp, and wheel scrolling. Build the chain and call perform().

34. How do you upload a file?

Call sendKeys with the absolute file path on the <input type="file"> element. Do not click the input, which opens a native dialog Selenium cannot control. On a remote Grid, set a LocalFileDetector so the file is sent to the node.

35. How do you manage cookies?

addCookie, getCookieNamed, getCookies, deleteCookieNamed and deleteAllCookies. You must be on a page of the cookie's domain before adding it. Injecting a session cookie is a common way to skip the login UI in tests that do not test login.

2 to 5 years: frameworks and Grid (questions 36 to 75)

36. What is the Page Object Model?

A design pattern where each page or component gets a class that holds its locators and exposes user actions as methods, such as login(user, password). Tests call those methods instead of touching locators, so a UI change is fixed in one class.

37. Should page objects contain assertions?

The Selenium documentation recommends keeping assertions in tests and out of page objects, with one exception: a page object can check that it is on the right page when it is created. This keeps page objects reusable across positive and negative tests.

38. What is PageFactory and is it still recommended?

PageFactory is a Java helper that initialises @FindBy fields lazily. Many maintainers advise against it now because its proxied elements make waits and stale element handling harder to reason about. Plain By fields with explicit waits are simpler.

39. What is the difference between a page object and a component object?

A component object models a part that appears on several pages, such as a header, date picker or data table. Pages are composed of components. This avoids copying the same locators into many page classes.

40. What is a StaleElementReferenceException?

It means the element you hold a reference to is no longer attached to the DOM, usually because the page re-rendered it. Fix it by locating the element again after the change, or by waiting for the re-render to finish before reading it.

41. What causes ElementClickInterceptedException?

Another element covers the click point, often a cookie banner, spinner overlay or sticky header. Wait for the overlay to disappear with invisibilityOfElementLocated, or close the banner. Forcing a JavaScript click hides a real usability problem.

42. What is the difference between NoSuchElementException and TimeoutException?

NoSuchElementException comes from a direct find that found nothing. TimeoutException comes from an explicit wait whose condition never became true. A timeout message names the condition, which is more useful when debugging.

43. How do you write a custom wait condition?

new WebDriverWait(driver, Duration.ofSeconds(10))
    .until(d -> d.findElements(By.cssSelector(".row")).size() >= 20);

Any function that returns a non-null, non-false value works as a condition.

44. What are page load strategies?

normal waits for the load event, eager waits for DOMContentLoaded, and none returns immediately. Eager can speed up pages with slow third-party assets, but then your waits must cover anything you depend on.

45. How do you structure a Selenium project with TestNG or JUnit?

Keep driver setup in a base class or fixture, page objects in their own package, test data outside the code, and reporting in listeners or extensions. TestNG gives groups, data providers and parallel settings in testng.xml; JUnit 5 gives extensions, tags and parallel execution through configuration properties.

46. What is the role of pytest fixtures in Selenium tests?

A fixture creates the driver, yields it to the test and quits it afterwards, even on failure. Fixture scope controls reuse: function scope gives each test a fresh browser, which is slower but isolated.

47. How do you implement data-driven tests?

Feed inputs from a TestNG @DataProvider, JUnit @ParameterizedTest or pytest.mark.parametrize, with values from code, CSV or JSON. Keep data sets small and meaningful; every row is a full browser test.

48. What is keyword-driven or hybrid testing?

Keyword-driven frameworks describe steps as keywords (open, type, click) in tables that non-programmers can edit, with code mapping each keyword to Selenium calls. Robot Framework with SeleniumLibrary is a well-known example. Hybrid frameworks combine keywords, data-driven input and page objects.

49. How does BDD with Cucumber fit with Selenium?

Cucumber maps Gherkin steps (Given, When, Then) to step definitions that call page objects. It helps when business people actually read or write the scenarios. If only engineers read them, it adds a translation layer with little gain.

50. How do you run tests in parallel safely?

Give every thread its own WebDriver, for example through a ThreadLocal<WebDriver> in Java or a function-scoped fixture with pytest-xdist. Tests must not share user accounts or data that one test changes and another reads.

51. What is Selenium Grid?

A system that routes WebDriver sessions to remote nodes, so one suite can run across many browsers and machines in parallel. Clients point a RemoteWebDriver at the Grid URL, by default port 4444.

52. What are the components of Selenium Grid 4?

Router (entry point), Distributor (assigns sessions to nodes), Session Map (session to node mapping), New Session Queue (holds requests until a slot frees up), Event Bus (messaging between components) and Nodes (run the browsers). Standalone mode runs all of them in one process; hub and node mode combines the central parts in the hub.

53. What are the Grid run modes?

Standalone (everything in one process, good for local use), hub and node (classic two-role setup) and distributed (each component started separately for large or Kubernetes deployments). The default Event Bus ports are 4442 and 4443, and the Router listens on 4444.

54. Show how to start a Grid in standalone mode and connect to it.

java -jar selenium-server-<version>.jar standalone
from selenium import webdriver
driver = webdriver.Remote(
    command_executor="http://localhost:4444",
    options=webdriver.FirefoxOptions(),
)

Replace the placeholder with the jar version you downloaded.

55. How do you run Grid with Docker?

The SeleniumHQ docker-selenium project publishes images such as selenium/standalone-chrome and node and hub images. A Docker Compose file starts a hub and one container per browser. Use --shm-size=2g or a mounted /dev/shm, because Chrome crashes with the small default shared memory.

56. How is Grid scaled on Kubernetes?

docker-selenium provides a Helm chart, and KEDA has a Selenium Grid scaler that adds browser node pods based on the New Session Queue length. Scaling nodes to zero between runs keeps cluster costs down.

57. What are capabilities and Options classes?

Capabilities describe the session you want: browser, version, platform and vendor settings. Selenium 4 uses Options classes such as ChromeOptions and FirefoxOptions; DesiredCapabilities is legacy. Vendor settings go under prefixed keys such as goog:chromeOptions and moz:firefoxOptions.

58. How do you run a cross-browser suite?

Parameterise the browser name, build the matching Options object in a factory, and run the same tests against each browser, locally or on a Grid. Run the full matrix nightly and one browser on every pull request to keep feedback fast.

59. How do you integrate Selenium into a CI pipeline?

Start the app or point at a test environment, start a Grid or use headless browsers on the agent, run the suite, then publish JUnit XML results, screenshots and logs as artifacts. Our scenario-based Selenium questions walk through pipeline failures in more depth.

60. Show a minimal GitHub Actions job for Selenium tests.

jobs:
  e2e:
    runs-on: ubuntu-latest
    services:
      selenium:
        image: selenium/standalone-chrome
        ports:
          - 4444:4444
        options: --shm-size=2g
    steps:
      - uses: actions/checkout@v4
      - run: pip install -r requirements.txt
      - run: pytest --grid-url=http://localhost:4444 --junitxml=results.xml

The --grid-url option is a custom pytest option defined in your conftest, not a built-in flag. Pin the image to a specific tag in real pipelines.

61. How do you produce test reports?

TestNG and JUnit write XML that CI servers display. Allure and ExtentReports add steps, screenshots and history. Whatever the tool, attach the screenshot, browser logs and the failing URL to each failed test.

62. How do you handle test data and environment configuration?

Keep base URLs, credentials references and browser choices in configuration files or environment variables, not in code. Create the data a test needs through an API before the test and clean it up afterwards.

63. How do you handle authentication without logging in through the UI every time?

Log in once through the UI in a dedicated login test. For other tests, get a session through an API call and inject the cookie, or reuse a stored session. This cuts minutes from large suites.

64. How do you handle shadow DOM elements?

Selenium 4 has getShadowRoot() on an element, which returns a search context you can query with CSS selectors. XPath does not work inside a shadow root.

65. How do you deal with dynamic IDs?

Anchor on stable attributes, the label text, or a data-testid the developers add. A CSS prefix match such as [id^='order-'] helps when only part of the id changes. Ask the team to add test attributes; it is cheaper than clever locators.

66. How do you verify a file download?

Set the browser download directory through Options preferences, trigger the download, then poll the directory until the file exists and has stopped growing. On Grid 4 the managed downloads feature (se:downloadsEnabled) lets the client list and fetch files from the node.

67. What is the difference between hard and soft assertions?

A hard assertion stops the test at the first failure. A soft assertion (TestNG SoftAssert, AssertJ SoftAssertions) collects failures and reports them together at the end. Use soft assertions to check several fields on one page.

68. How do you retry flaky tests and why be careful?

TestNG IRetryAnalyzer, the JUnit Pioneer retry extension or pytest-rerunfailures re-run failures. Retries hide real races in the application and in the tests, so track how often each test needs one and fix the worst offenders.

69. What is Selenium IDE good for?

Recording a quick reproduction, building simple smoke checks and helping beginners learn locators. It can export recordings to code in several languages. For a maintained suite, hand-written code with page objects scales better.

70. How do you test responsive layouts?

Set the window size with setSize, or use Chrome mobile emulation through ChromeOptions. Emulation is not a real device; real mobile browsers need Appium, which builds on the WebDriver protocol.

71. How do you capture browser console logs?

Chromium exposes logs through the logging capability and driver.manage().logs() in Java. Selenium 4 BiDi APIs can subscribe to console messages and JavaScript errors as they happen, across browsers that support WebDriver BiDi.

72. What is the Chrome DevTools Protocol support in Selenium 4?

Chromium-based drivers expose CDP through getDevTools() or execute_cdp_cmd, used for network emulation, geolocation and intercepting requests. It is tied to Chrome versions, and the project is moving users to WebDriver BiDi as the cross-browser replacement.

73. What is WebDriver BiDi?

A W3C draft protocol that adds two-way, event-based communication over WebSocket to WebDriver. It enables listening to console logs, network events and DOM mutations. Selenium is adding BiDi-backed APIs browser by browser; check the Selenium docs for which APIs are stable in your language binding.

74. How do you test pages that need basic HTTP authentication?

Selenium 4 Chromium drivers can register credentials through the network or BiDi APIs, for example HasAuthentication in Java. Putting credentials in the URL works in some browsers but is not reliable and leaks them into logs.

75. How do you keep a Selenium suite fast?

Push checks down the test pyramid to unit and API tests, keep UI tests for user journeys, set up data through APIs, run in parallel, and avoid fixed sleeps. Our guide on which tests to automate first in CI covers that split.

Senior: design, scale and reliability (questions 76 to 92)

76. How would you design a Selenium framework for a large product?

Layers: a driver factory that reads configuration, page and component objects, a test data layer that talks to APIs, the tests themselves, and reporting. Add a clear tagging scheme (smoke, regression), parallel execution and one place where waits and retries live. Keep it boring enough that new team members can add tests in a day.

77. How do you measure and reduce flakiness?

Record every test result with its retry count and failure reason over time. Rank tests by failure rate, then group causes: synchronisation, test data collisions, environment instability and real application races. Quarantine tests that fail without code changes, fix them, and return them to the gate.

78. When should you not use Selenium?

When an API or component test can check the same behaviour faster, for load testing (use a tool such as k6), for native mobile apps (Appium) and when the team's stack and skills favour another tool that fits better. Selenium shines for multi-language teams and wide browser coverage through the W3C standard.

79. How does Selenium compare with Playwright and Cypress?

AreaSeleniumPlaywrightCypress
ProtocolW3C WebDriver, BiDiOwn protocol to patched or stock browsersRuns in the browser
LanguagesJava, Python, C#, Ruby, JavaScript and moreJavaScript/TypeScript, Python, Java, .NETJavaScript/TypeScript
Auto-waitingExplicit waits you writeBuilt inBuilt in
Grid or scalingSelenium Grid, cloud vendorsSharding in the runnerParallelism through its cloud or CI

Interviewers want trade-offs, not a winner. Check each project's docs for current browser and language support.

80. How do you run thousands of tests within a short CI window?

Shard the suite across many CI jobs or Grid nodes, split by historical duration rather than file count, run smoke tests first, and fail fast on the critical path. Autoscale nodes so capacity follows demand instead of staying idle.

81. How do you manage browser and driver versions across teams?

Let Selenium Manager resolve drivers, pin browser versions in the Docker images used by CI, and update both on a schedule with a canary run. Unpinned browsers on shared agents are a common source of sudden mass failures.

82. How do you secure credentials used by Selenium tests?

Store them in the CI secret store or a vault, inject them as environment variables, use dedicated test accounts with minimal rights, and mask them in logs and reports. Never commit them in properties files or page objects.

83. How do you test an application behind SSO?

Use a test identity provider tenant or a backdoor token endpoint that exists only in test environments, then inject the session. Automating a production identity provider login is brittle and may trip its bot protection.

84. How do you handle third-party widgets that slow tests, such as chat or analytics scripts?

Block them in test environments through configuration, or use network interception (CDP or BiDi) to stub the requests. Document which scripts are blocked so no one is surprised by a difference from production.

85. What metrics would you report for a UI test suite?

Pass rate on the main branch, flaky rate, median and p95 duration, time from commit to result, and the number of production defects the suite missed. Duration and flakiness tell you whether developers will keep trusting it.

86. How do you decide what goes in the end-to-end layer?

Pick the journeys that make money or would cause an incident if broken: sign-up, login, search, checkout, key admin flows. Everything else should be covered lower in the pyramid. Revisit the list when product priorities change.

87. How do you run Selenium tests against feature branches?

Deploy each branch to a short-lived preview environment, run the smoke set against its URL, and post results back to the merge request. Clean up environments when the branch merges.

88. How do you test accessibility with Selenium?

Inject an engine such as axe-core through its Selenium integration and fail builds on serious violations. Automated checks find a portion of issues; keyboard and screen reader checks still need people.

89. How do you handle time zones, locales and dates in tests?

Set the browser locale and time zone through Options or emulation, freeze test data dates where possible, and avoid assertions on 'today' that break at midnight in the CI server's time zone.

90. How do you review a pull request that adds Selenium tests?

Check locator stability, explicit waits instead of sleeps, independence from other tests, cleanup of data, meaningful assertions and runtime. Ask whether a lower-level test would cover the same thing.

91. How do you migrate a Selenium 3 suite to Selenium 4?

Replace DesiredCapabilities with Options classes, update wait constructors to take Duration, remove deprecated findElementBy... methods in favour of findElement(By...), drop driver download code in favour of Selenium Manager, and move Grid 3 hub configuration to Grid 4. The Selenium site has an upgrade guide.

92. How do you keep test code quality high?

Apply the same standards as product code: reviews, linters, small functions, no copy-pasted locators, and refactoring when page objects grow too big. Delete tests that no longer protect anything.

Scenario questions (questions 93 to 102)

93. Tests pass locally but fail on CI with timeouts. What do you check?

Compare the environments: headless window size, CPU and memory on the agent, browser version, network access to test services and data state. Read the failure screenshot first; a small viewport often hides the element behind a collapsed menu. Then look at timing with the CI agent's logs.

94. A test fails one run in twenty. How do you investigate?

Run it in a loop with tracing or video, collect the failing artifacts, and look for missing waits, shared data, animations and asynchronous requests that finish after the assertion. Fix the cause rather than adding a retry.

95. Chrome crashes in Docker with 'session deleted because of page crash'. What is the fix?

Increase shared memory with --shm-size=2g or mount the host /dev/shm. Also check the container memory limit and that each container runs only as many sessions as it can handle.

96. Grid sessions queue for minutes. What do you look at?

Node slot counts versus parallel test threads, nodes that registered but are unhealthy, sessions that never quit and hold slots, and the session request timeout. The Grid UI and its GraphQL endpoint show queue and slot usage.

97. A button click does nothing but no error is raised. What do you suspect?

The click happened before the page attached its JavaScript handler, or it landed on a different element. Wait for a signal that the app is ready, such as a spinner disappearing, and assert the result of the click instead of assuming it worked.

98. Your suite takes 90 minutes and developers ignore it. What would you do?

Measure where time goes, move checks to API tests, split a fast smoke set for pull requests and a full set for nightly runs, parallelise on Grid and remove duplicated journeys. Set a target, such as smoke under ten minutes, and track it.

99. After a UI redesign, half of the tests fail on locators. How do you recover?

Fix the shared page and component objects first, since one change there repairs many tests. Agree with developers on data-testid attributes for key elements so the next redesign does not repeat this.

100. A test must verify an email sent by the app. How?

Use a test mail service or a capture tool with an API in the test environment, poll it for the message and extract the link. Do not automate a real webmail UI.

101. Tests interfere with each other in parallel runs. What is wrong?

Usually shared state: one user account, shared records, a static WebDriver, or tests that depend on order. Give each test its own data and driver and make tests runnable in any order.

102. A new browser release breaks many tests overnight. How do you respond?

Pin CI to the previous browser image to unblock the team, reproduce on the new version in a separate job, check the Selenium and browser release notes, and update once the fix is understood. Keep browser updates as a deliberate, tested change.

Where Selenium fits in a DevOps pipeline

UI tests are the slowest and most fragile layer, so they belong at the top of the pyramid. Pair this page with our articles on shift-left testing and API testing tools, and use k6 for load rather than Selenium. To practise test stages inside real pipelines, see the DevOps training in Pune, available in our Kharadi classroom and live online.

Frequently asked questions

How many Selenium questions are on this page?

There are 102 numbered questions: 35 for freshers, 40 for 2 to 5 years of experience, 17 for senior roles and 10 scenarios. Each has a direct answer first.

Which language should I use for Selenium interviews?

Use the language the job ad names. Java and Python are the most common, and the WebDriver concepts are the same in every binding.

Is Selenium RC still asked in interviews?

Only as history. RC was removed from the main distribution with Selenium 3, and Selenium 4 uses the W3C WebDriver protocol.

Do I still need to download chromedriver manually?

Usually not. Selenium Manager, bundled since Selenium 4.6, finds or downloads a matching driver when none is on the PATH.

What is the most common reason for flaky Selenium tests?

Poor synchronisation: fixed sleeps, missing explicit waits or mixing implicit and explicit waits. Shared test data is the next most common cause.

What port does Selenium Grid use?

The Grid Router listens on 4444 by default, and the Event Bus uses 4442 and 4443.

Should I learn Playwright instead of Selenium?

Learn the one your target jobs ask for. Knowing the trade-offs between Selenium, Playwright and Cypress is itself a common senior question.

Official references

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.