Bird
0
0

How can you combine a retry decorator with Selenium's explicit waits to improve flaky test stability?

hard📝 Application Q9 of 15
Selenium Python - Advanced Patterns
How can you combine a retry decorator with Selenium's explicit waits to improve flaky test stability?
AUse retry to rerun the test and explicit waits to wait for elements before actions
BUse retry only and avoid explicit waits to speed up tests
CUse explicit waits inside retry decorator to wait after test finishes
DUse retry to skip tests and explicit waits to ignore exceptions
Step-by-Step Solution
Solution:
  1. Step 1: Understand retry and explicit waits roles

    Retry reruns tests on failure; explicit waits wait for elements to be ready.
  2. Step 2: Combine for stability

    Using explicit waits reduces flaky failures; retry handles remaining intermittent issues.
  3. Final Answer:

    Use retry to rerun the test and explicit waits to wait for elements before actions -> Option A
  4. Quick Check:

    Retry + explicit waits = better flaky test handling [OK]
Quick Trick: Combine retry with waits for stable Selenium tests [OK]
Common Mistakes:
  • Skipping explicit waits thinking retry is enough
  • Using waits after test finishes
  • Misusing retry to skip tests

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes