Selenium Senior interview questions and answers
75 questions for a Selenium (Senior) interview - with correct answers, explanations and links to the docs.
- 1.What layers does a maintainable Selenium framework usually have?
- 2.Why is classic WebDriver slower per action than tools using CDP or BiDi directly?
- 3.A suite on a remote Grid is twice as slow as locally. What is a likely cause?
- 4.How should a team decide which browsers to run in CI?
- 5.What's a sound policy for flaky UI tests?
- 6.Where does Selenium fit in a healthy test strategy?
- 7.How can a team make the UI testable at scale?
- 8.What are the risks of self-healing locator tools?
- 9.How do you test a flow with a CAPTCHA?
- 10.How should UI tests handle 2FA logins?
- 11.How do you automate an 'email verification link' flow?
- 12.What's the issue with screenshots and logs from tests on staging with real-looking data?
- 13.How do you avoid leaking credentials from Selenium tests in CI?
- 14.How can Selenium tests mock backend responses for a UI test?
- 15.Why is coupling to CDP versions a maintenance cost in Selenium 4?
- 16.When does migrating from Selenium to Playwright make sense?
- 17.What's a key difference between Selenium and Playwright waiting?
- 18.How do you size a self-hosted Grid?
- 19.What can cause 'zombie' browser processes on CI agents?
- 20.Why should parallel UI tests use isolated test data, e.g. unique tenants or accounts?
- 21.How do you test features behind feature flags in UI suites?
- 22.What does
acceptInsecureCertsdo, and when is it acceptable? - 23.How do you add accessibility checks to a Selenium suite?
- 24.What metrics help manage a large Selenium suite?
- 25.Why may a page object generator from HTML be a poor idea?
- 26.How should tests deal with time-dependent UI, like 'expires in 3 days'?
- 27.Why can't Selenium reach elements in a closed shadow root?
- 28.What limits testing of a cross-origin iframe like a payment widget?
- 29.How do you speed up a slow UI suite without losing coverage?
- 30.What problem does sharding a UI suite across CI jobs solve?
- 31.Why record videos of failed UI tests on Grid?
- 32.What's the downside of a single shared login state for all tests in a suite?
- 33.How should UI tests verify data shown in a grid that comes from an API?
- 34.What is the danger of very large page objects?
- 35.Why should a framework separate 'what' (business steps) from 'how' (UI actions)?
- 36.How do you handle different environments (dev, staging) in a framework?
- 37.What's a good way to review new UI tests?
- 38.Why do implicit waits interact badly with negative checks at scale?
- 39.How can BiDi network events help debug a flaky UI test?
- 40.When is it reasonable to wait for 'network idle' in Selenium?
- 41.How do you make UI test failures actionable for developers?
- 42.What does testing a single-page app need beyond classic page loads?
- 43.How do you test that a page doesn't make an unexpected API call twice?
- 44.Why should UI tests not depend on animations finishing at a fixed time?
- 45.What is the trade-off of using a cloud Selenium provider?
- 46.How do you keep a Selenium framework up to date safely?
- 47.Why does a test that uses
Thread.sleep'fix' sometimes hide a product bug? - 48.What's a reasonable timeout policy for explicit waits?
- 49.How do you verify downloads when tests run on a remote Grid?
- 50.What does
LocalFileDetectordo for file uploads on Grid? - 51.Why should tests not share one browser profile on disk?
- 52.What should a test framework do with test results over time?
- 53.How do you stub a third-party script, like a chat widget, that slows tests?
- 54.What is a 'test hook' in the product and when is it acceptable?
- 55.Why may a large Selenium suite hit memory limits on agents over a long run?
- 56.How do you test a site's behavior under a slow network in Selenium 4?
- 57.What does 'test the UI, not the backend, through the browser' mean?
- 58.Why should exceptions from page objects include the locator and page?
- 59.How can a team reduce UI test maintenance after redesigns?
- 60.What does a good failure triage process look like?
- 61.Why should UI tests avoid depending on production-like third-party services?
- 62.How do you decide what goes into a smoke suite?
- 63.What's a typical cause of
SessionNotCreatedException? - 64.Why are mobile web tests via desktop emulation not enough?
- 65.How do you keep UI tests stable across time zones of CI agents?
- 66.What does a 'quarantine' for flaky tests need to work?
- 67.When is a UI test the wrong tool for a check?
- 68.Why should locators be reviewed like code?
- 69.What's the purpose of a 'canary' run of the UI suite after upgrades?
- 70.How should a framework handle environment instability, like a slow staging?
- 71.Why is it useful to tag tests by area and criticality?
- 72.What should happen when a UI test finds a real bug?
- 73.How do you test the same flow in many locales efficiently?
- 74.Why may a test framework prefer composition of helpers over a deep BaseTest?
- 75.Why should a Selenium framework keep one WebDriver per thread in parallel runs?