Selenium Interview Questions and Answers for Selenium 4

These Selenium interview questions are written for how Selenium works today, in the Selenium 4 era: Selenium Manager instead of hand-downloaded drivers, browser options instead of DesiredCapabilities, a six-part Grid, and WebDriver BiDi slowly replacing Chrome DevTools tricks. Many question banks still cover Selenium RC and removed APIs, and US and UK interviewers notice outdated answers.

The 32 questions below run from beginner to scenario-based, with short answers and Python examples checked against Selenium 4.54. Use them to test yourself, then practise the code. If you would like structured practice with a trainer, our live Selenium training covers WebDriver, frameworks and Grid step by step.

Key takeaways

  • Know the current toolset: WebDriver, Grid and the standalone Selenium IDE. Selenium RC is legacy history only.
  • Selenium Manager (since 4.6) finds or downloads drivers automatically when you do not provide one.
  • Expect deep questions on waits. The official docs warn against mixing implicit and explicit waits.
  • Selenium 4 uses Options classes, relative locators, Shadow DOM support and the W3C WebDriver standard.
  • Senior rounds cover Grid 4, WebDriver BiDi, Page Object rules and what not to automate.

Beginner Selenium interview questions

1. What is Selenium, and what are its main components?

Selenium is an open-source umbrella project for automating web browsers. Its three parts are WebDriver (a language API that drives browsers), Selenium Grid (runs tests in parallel across machines and browsers) and Selenium IDE (records and plays back user actions). The current IDE is a standalone app for Windows, macOS and Linux; the old browser extension (version 3) is no longer maintained.

Advertisement

2. Is Selenium free, and which languages does it support?

Yes. Selenium is released under the Apache License 2.0. Official bindings exist for Java, Python, C#, Ruby and JavaScript, and Kotlin teams use the Java bindings. Current Python releases need Python 3.10 or newer, since support for 3.9 ended with Selenium 4.37.

3. What is Selenium RC, and should you still use it?

Selenium RC was the original version of Selenium. Selenium 3 was the WebDriver implementation without the RC code, and Selenium 4 has replaced Selenium 3. The docs keep RC pages only for historical reasons, so the right interview answer is that RC is obsolete and all new work uses WebDriver.

4. How does WebDriver communicate with the browser?

Your test code sends commands through a browser-specific driver (such as chromedriver or geckodriver), which controls the browser. The protocol is the W3C WebDriver standard, which became a W3C Recommendation in June 2018. Because each driver implements the same standard, one test can run across browsers with small changes.

5. What is Selenium Manager?

Selenium Manager is Selenium’s official command-line tool for driver and browser management, shipped with every release since 4.6. It works as a fallback: if you do not provide a driver, it discovers, downloads and caches the right one when the driver object is created. From 4.11 onward it can also manage browsers themselves, starting with Chrome through Chrome for Testing. This removed the need for third-party driver managers in many projects.

6. Which locator strategies does Selenium support?

There are eight traditional strategies: id, name, class name, tag name, link text, partial link text, CSS selector and XPath. The docs recommend an ID when it is unique and predictable, otherwise a well-written CSS selector. XPath is powerful but harder to read and debug, and link text only works on links.

7. What is the difference between find_element and find_elements?

find_element returns the first matching element and raises NoSuchElementException when nothing matches at that moment. find_elements returns a list and, if there are no matches, an empty list, which makes it handy for checking that something is absent.

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

close() closes the current window or tab. quit() closes all windows and ends the WebDriver session. Always call quit() at the end of a test, usually in teardown, or you leave browser and driver processes running.

9. Write a basic Selenium 4 test in Python.

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()          # Selenium Manager finds the driver
try:
    driver.get("https://www.selenium.dev/selenium/web/web-form.html")
    driver.find_element(By.NAME, "my-text").send_keys("Selenium")
    driver.find_element(By.CSS_SELECTOR, "button").click()
    message = driver.find_element(By.ID, "message").text
    assert message == "Received!"
finally:
    driver.quit()

Interviewers often check that you use find_element(By..., ...). The older find_element_by_id style helpers were removed from the Python bindings in Selenium 4.3.0, so code that still uses them fails on current versions.

Intermediate Selenium interview questions

10. Explain implicit and explicit waits. Can you mix them?

An implicit wait is a global setting that applies to every element lookup for the whole session (the default is 0). An explicit wait uses WebDriverWait to poll for one specific condition, such as an element becoming visible. The official docs say not to mix the two because wait times become unpredictable; for example, a 10 second implicit wait combined with a 15 second explicit wait can time out after 20 seconds. Most teams use explicit waits only.

11. What is a fluent wait?

A fluent wait is an explicit wait with custom polling interval, timeout and ignored exceptions. In Java it is the FluentWait class; in Python you pass the options to WebDriverWait:

from selenium.common.exceptions import NoSuchElementException, ElementNotInteractableException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

wait = WebDriverWait(driver, timeout=10, poll_frequency=0.5,
                     ignored_exceptions=[NoSuchElementException, ElementNotInteractableException])
button = wait.until(EC.element_to_be_clickable((By.ID, "submit")))

12. What causes a StaleElementReferenceException, and how do you fix it?

It means an element you found earlier can no longer be used, typically because the DOM changed or refreshed, the page navigated, or you switched to another window or frame. Selenium does not relocate elements automatically. The fix is to find the element again after the change (often inside an explicit wait) or switch back to the right context.

13. How do you handle multiple windows or tabs?

Every window has a handle. Store driver.current_window_handle, read driver.window_handles after the new window opens, and switch with driver.switch_to.window(handle). Selenium 4 can also open one directly with driver.switch_to.new_window("tab"). Switch back to the original handle when you are done.

14. How do you work with iframes?

Switch into the frame before locating elements inside it, using the frame’s WebElement, its name or ID, or an index. Return to the main page with driver.switch_to.default_content(). Forgetting to switch is a classic cause of NoSuchElementException.

15. How do you handle JavaScript alerts?

Wait for the alert, then act on it: alert = wait.until(EC.alert_is_present()), then read alert.text, call alert.accept() or alert.dismiss(), or use alert.send_keys() for a prompt. Selenium handles three types: alert, confirm and prompt.

16. How do you select an option from a dropdown?

For a native <select> element, wrap it in the Select support class (from selenium.webdriver.support.select import Select) and call select_by_visible_text(), select_by_value() or select_by_index(). Custom dropdowns built from divs are handled as ordinary clicks instead.

17. What is the Actions API used for?

It is a low-level interface for virtual keyboard, pointer and wheel input. Use it for hover, right-click, double-click, drag and drop, key combinations and scrolling, for example ActionChains(driver).drag_and_drop(source, target).perform(). Wheel input (scrolling) arrived in Selenium 4.2.

18. What are relative locators?

Introduced in Selenium 4, relative locators find elements by their position relative to another element: above, below, to the left of, to the right of, or near (within 50 pixels). For example, locate_with(By.TAG_NAME, "input").above({By.ID: "password"}) finds the input above the password field. They depend on layout, so use them carefully on responsive pages.

19. What replaced DesiredCapabilities in Selenium 4?

Browser Options classes such as ChromeOptions, FirefoxOptions and EdgeOptions. The docs state that Selenium 4 requires the options classes. You set arguments, the page load strategy and browser-specific settings on them, for example options.add_argument("--headless=new") to run Chrome headless.

20. What are page load strategies?

They control when driver.get() returns. normal (the default) waits for the full load event, eager waits until the DOM is interactive (DOMContentLoaded), and none waits only for the initial page download. Set it with options.page_load_strategy = "eager".

21. How do you interact with elements inside a Shadow DOM?

Find the shadow host, get its shadow root (host.shadow_root in Python, getShadowRoot() in Java), then search inside that root. This support arrived with Selenium 4 and avoids the JavaScript workarounds older suites used.

Advertisement

22. How do you upload a file?

Send the file’s full path to the input type="file" element with send_keys(); no OS dialog is involved. On a remote Grid the file must reach the node: the Python bindings add a local file detector by default, while Java needs setFileDetector(new LocalFileDetector()).

Advanced Selenium interview questions

23. Explain the Page Object Model and its rules.

A page object is a class that acts as the interface to one page (or component) of the application, so tests call methods like login_page.sign_in(user) instead of repeating locators. The Selenium docs add important rules: page objects should not make assertions (except checking the page loaded), methods should return other page objects, and they should rarely expose the WebDriver instance. Following these rules keeps locator changes in one place.

24. What are the components of Selenium Grid 4?

Grid 4 has six components. The Router is the entry point that forwards requests. The Distributor registers nodes and assigns new session requests. The Session Map maps session IDs to nodes. The New Session Queue holds new session requests in FIFO order. The Node manages browser slots on its machine. The Event Bus connects the components.

25. How can you run Selenium Grid, and which mode would you choose?

Grid runs in three modes. Standalone runs every component in one process (java -jar selenium-server-<version>.jar standalone) and suits local or small setups. Hub and node splits a hub from one or more nodes, a common choice when you need a few machines. Distributed runs each component separately for large, highly available grids. Tests connect with a Remote WebDriver pointing at the Grid URL, and the Grid server needs Java 11 or newer.

26. What is WebDriver BiDi, and how does it relate to CDP?

WebDriver BiDi is a W3C draft protocol that adds two-way communication, so the browser can push events (console messages, network activity) to your test. Selenium is moving its implementation from classic WebDriver to BiDi while keeping backward compatibility. Chrome DevTools Protocol (CDP) support in Selenium is described as temporary until BiDi covers the same ground, and CDP support for Firefox was removed entirely in Selenium 4.29.

27. How do you capture browser console logs or JavaScript errors?

With BiDi enabled (options.enable_bidi = True in Python), register handlers: driver.script.add_console_message_handler(logs.append) collects console messages and add_javascript_error_handler collects uncaught errors. BiDi network handlers can also intercept requests and responses, which is useful for checking that a page does not throw errors during a flow.

28. How do you test file downloads on a Grid?

Start the Grid with managed downloads enabled (--enable-managed-downloads true) and set the se:downloadsEnabled capability (options.enable_downloads = True in Python). You can then list, fetch and delete files with get_downloadable_files(), download_file() and delete_downloadable_files(). Selenium does not wait for downloads to finish, so you must add your own wait.

Scenario-based Selenium interview questions

29. Your tests pass locally but fail randomly in CI. How do you investigate?

Start with synchronisation: remove fixed sleeps, check nobody mixed implicit and explicit waits, and wait for the exact condition each step needs. Then look for shared state, since the docs recommend not sharing test data and creating a fresh WebDriver per test. Capture screenshots and console errors on failure, and compare browser versions between local and CI.

30. The product owner asks you to automate a login that has a CAPTCHA and two-factor authentication. What do you say?

That neither should be automated. The Selenium docs list CAPTCHA and 2FA as discouraged: CAPTCHAs exist to block automation, so disable them in the test environment, and for 2FA use test accounts with it switched off or a test-only token. You still test those features, but separately and with the right tools.

31. Can you use Selenium for load testing?

Not well. The docs say performance testing with Selenium is generally not advised, because browser startup and rendering add noise that has nothing to do with server performance. Recommend a dedicated tool such as Apache JMeter for load, and keep Selenium for functional user journeys.

32. You inherit a Selenium 3 suite. What would you change first?

Upgrade the bindings, then fix what breaks: replace DesiredCapabilities with Options classes, replace removed find_element_by_* calls with find_element(By..., ...), and try removing a third-party driver manager in favour of Selenium Manager. After that, standardise on explicit waits, move locators into page objects, and if you use Grid, move to Grid 4. Teams comparing frameworks at this stage may also read our Playwright tutorial for beginners to see how a newer tool approaches the same problems.

How to prepare for a Selenium interview

Pick one language and build a small framework: page objects, explicit waits, a test runner, screenshots on failure and a CI job. Brush up on the language too; Java roles often add core Java questions, and Kotlin teams use the same Java bindings (our Kotlin interview questions help there). Finally, update your CV so it names concrete Selenium 4, Grid and CI skills; the free Tutorials Mania Resume Builder makes that quick. You can also explore all our live online IT courses, including Playwright training if your target companies use both tools.

Learn Selenium with live, instructor-led training

Our live online Selenium course takes you from Java basics and WebDriver to locators, waits, Page Object Model, TestNG, data-driven testing, Selenium Grid and CI/CD integration. You build a working framework in hands-on labs and get interview and certification guidance along the way.

Enroll Now Request a Free Demo

Frequently asked questions

Is Selenium still relevant?

Yes. Selenium releases arrive every few weeks (4.54 shipped in November 2026), it implements the W3C WebDriver standard, and it supports five official language bindings. Newer tools compete with it, but Selenium remains actively developed and widely used for browser automation.

Which language is best for Selenium interviews?

Use the language of the job ad. The concepts are the same across bindings, so a solid grasp of waits, locators and framework design carries over whichever language you use.

Is there an official Selenium certification?

The selenium.dev website does not advertise an official Selenium certification from the project itself. Third-party bodies offer exams, for example the A4Q Certified Selenium 4 Tester Foundation from iSQI, so focus your preparation on hands-on framework experience as well.

What Selenium questions are asked for 5 years of experience?

Expect framework design, Grid architecture, parallel execution, flaky test analysis, CI integration, BiDi and migration from older versions, often as scenario questions like the ones in the last section above.

Sources

  • Selenium documentation (selenium.dev): WebDriver, Selenium Manager, waits, BiDi, Grid, test practices and legacy pages
  • Selenium downloads page and blog (Selenium 4.54 release, Python 3.9 end of support, CDP removal for Firefox)
  • Selenium Python bindings changelog (removal of find_element_by_* in 4.3.0) and Python API reference
  • W3C: WebDriver Level 1 Recommendation and WebDriver BiDi Working Draft
  • Selenium LICENSE file on GitHub (Apache License 2.0)
  • iSQI: A4Q Certified Selenium 4 Tester Foundation
Advertisement

About Tutorials Mania Editorial Team

The Tutorials Mania Editorial Team writes and maintains the site's technology tutorials, interview guides and coverage of AI tools and platforms. Every article is researched against official documentation, product announcements and primary sources, written to explain complex technology in plain language, and updated when products change.
View all posts by Tutorials Mania Editorial Team →