Selenium WebDriver Research & Evidence-Based Practice 3 — Questions and Answers
Question 1: In Selenium research, which approach to handling StaleElementReferenceException is considered the most robust?
- Wrapping every interaction in a try-catch that silently ignores the exception
- Re-locating the element just before each interaction using a fresh WebDriver.findElement() call (Correct answer)
- Switching to JavaScript executor to bypass WebDriver element references
- Increasing implicit wait timeout globally to 30 seconds
Correct answer: Re-locating the element just before each interaction using a fresh WebDriver.findElement() call
Re-fetching the element reference immediately before use ensures the reference points to the current DOM state.
Question 2: Evidence shows that Selenium tests integrated into CI/CD pipelines deliver the most value when run at which stage?
- Only nightly in a separate scheduled job
- After every code commit as part of the pull request validation gate (Correct answer)
- Manually triggered by QA before each quarterly release
- Once per week during a dedicated regression window
Correct answer: After every code commit as part of the pull request validation gate
Running on every commit provides immediate feedback to developers while the context of the change is fresh.
Question 3: Which research-supported screenshot strategy in Selenium provides the highest debugging value?
- Capturing screenshots only on test pass to confirm final state
- Taking screenshots exclusively at test start for baseline comparison
- Capturing screenshots automatically on test failure with the failing step context (Correct answer)
- Generating a screenshot every 500ms throughout the test run
Correct answer: Capturing screenshots automatically on test failure with the failing step context
Failure-triggered screenshots capture the UI state at the exact moment of failure, giving engineers actionable diagnostic context.
Question 4: Studies on Selenium test maintenance show that tests written without explicit assertions on expected state most commonly lead to:
- False positives — tests pass even when the application is broken (Correct answer)
- Faster test execution due to fewer DOM queries
- Better compatibility across browser versions
- Reduced need for Page Object Model
Correct answer: False positives — tests pass even when the application is broken
Without assertions, Selenium will complete navigation and interactions without verifying outcomes, masking application defects.
Question 5: Research into cross-browser testing recommends which prioritization strategy when browser coverage must be limited by budget?
- Test only on the browser used by the development team
- Prioritize browsers by actual user traffic share from analytics data (Correct answer)
- Always test on the oldest supported browser version first
- Rotate browsers alphabetically across test runs
Correct answer: Prioritize browsers by actual user traffic share from analytics data
Analytics data ensures testing effort is proportional to real user impact, maximizing defect detection for the audience.
Question 6: The 'Arrange-Act-Assert' (AAA) pattern applied to Selenium tests is evidence-based because it primarily:
- Reduces the number of WebDriver API calls per test
- Improves readability and isolates the action under test from setup and verification (Correct answer)
- Automatically generates test data for data-driven scenarios
- Enables parallel execution without thread-safety concerns
Correct answer: Improves readability and isolates the action under test from setup and verification
AAA gives each test a clear structure so readers instantly understand preconditions, the action being tested, and the expected outcome.
Question 7: Evidence from accessibility testing research suggests integrating axe-core with Selenium provides which key advantage over manual audits?
- It can test screen reader audio output directly through WebDriver
- It runs WCAG rule checks programmatically on every test run, catching regressions early (Correct answer)
- It automatically fixes accessibility violations in the DOM
- It replaces the need for keyboard-navigation testing
Correct answer: It runs WCAG rule checks programmatically on every test run, catching regressions early
Automated axe-core checks run on every CI execution, making accessibility a continuous quality gate rather than a periodic manual review.
In Selenium research, which approach to handling StaleElementReferenceException is considered the most robust?