Bird
0
0

A Selenium test in CI intermittently fails due to timing issues. What is the best fix?

medium📝 Debug Q7 of 15
Selenium Python - CI/CD Integration
A Selenium test in CI intermittently fails due to timing issues. What is the best fix?
ARemove all waits to speed up tests
BRun tests only once a month to reduce failures
CIgnore failures since they are random
DAdd explicit waits to ensure elements load before interaction
Step-by-Step Solution
Solution:
  1. Step 1: Identify cause of intermittent failures

    Timing issues often happen when elements are not ready before actions.
  2. Step 2: Apply best practice for Selenium tests

    Explicit waits pause test until elements are ready, reducing flakiness.
  3. Final Answer:

    Add explicit waits to ensure elements load before interaction -> Option D
  4. Quick Check:

    Use explicit waits to fix timing issues = B [OK]
Quick Trick: Use explicit waits to fix flaky Selenium tests [OK]
Common Mistakes:
  • Removing waits causing more failures
  • Ignoring flaky test failures

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes