Selenium WebDriver Professional Standards & Competencies 2 — Questions and Answers
Question 1: A QA engineer notices that a Selenium test suite runs for 45 minutes on CI. What is the most professional first step to address this?
- Delete low-value tests to reduce count
- Profile which tests are slowest and identify parallelization opportunities (Correct answer)
- Switch from Firefox to Chrome driver for speed
- Increase the CI server timeout setting
Correct answer: Profile which tests are slowest and identify parallelization opportunities
Profiling slowest tests and parallelizing them is the standard professional approach to reducing test suite runtime without sacrificing coverage.
Question 2: Which practice best demonstrates professional test isolation in a Selenium project?
- Sharing a single WebDriver instance across all tests in a class
- Using @BeforeEach to create a new driver and @AfterEach to quit it (Correct answer)
- Reusing browser sessions to save startup time
- Running tests alphabetically so state carries over predictably
Correct answer: Using @BeforeEach to create a new driver and @AfterEach to quit it
Creating a fresh WebDriver per test and tearing it down afterward ensures no shared state bleeds between tests.
Question 3: A team member hard-codes absolute XPaths like `/html/body/div[3]/form/input[2]` throughout the test suite. What professional concern does this raise?
- Absolute XPaths execute faster than relative ones
- They are tightly coupled to DOM structure and break on minor UI changes (Correct answer)
- This is preferred because it avoids ambiguity
- Absolute XPaths are only problematic in Firefox
Correct answer: They are tightly coupled to DOM structure and break on minor UI changes
Absolute XPaths are brittle because any structural change to the HTML invalidates the path, leading to high maintenance overhead.
Question 4: What does the Page Object Model (POM) pattern primarily help a Selenium professional achieve?
- Faster test execution by caching page elements
- Separation of test logic from page interaction details, improving maintainability (Correct answer)
- Automatic retry of flaky tests
- Cross-browser compatibility without driver changes
Correct answer: Separation of test logic from page interaction details, improving maintainability
POM encapsulates page-specific selectors and actions in dedicated classes, so tests remain clean and UI changes require updates in only one place.
Question 5: A professional automation engineer is asked to test a feature not yet deployed to staging. What is the correct course of action?
- Write and commit the tests with pending/skip annotations and coordinate with the dev team on readiness (Correct answer)
- Automate against production to get real data
- Delay all automation work until every feature is complete
- Hard-code expected data from design mockups into assertions
Correct answer: Write and commit the tests with pending/skip annotations and coordinate with the dev team on readiness
Writing tests marked as pending and coordinating with developers ensures automation is ready when the feature lands without blocking the pipeline.
Question 6: Which metric is most relevant when evaluating the professional quality of a Selenium test suite?
- Total number of test files
- Defect escape rate caught by automated tests (Correct answer)
- Lines of test code written per sprint
- Number of selectors using ID attributes
Correct answer: Defect escape rate caught by automated tests
Defect escape rate measures how many bugs slip past automation into production, directly reflecting test suite effectiveness.
Question 7: When a Selenium test fails intermittently (flaky), what is the professional recommended response?
- Add Thread.sleep() calls until the test passes consistently
- Mark the test as quarantined, investigate root cause, and fix the timing or isolation issue (Correct answer)
- Delete the test since it cannot be trusted
- Increase retry count to 10 in the CI runner
Correct answer: Mark the test as quarantined, investigate root cause, and fix the timing or isolation issue
Quarantining flaky tests prevents noise in the pipeline while a proper investigation and fix addresses the underlying cause.
A QA engineer notices that a Selenium test suite runs for 45 minutes on CI.
What is the most professional first step to address this?