Bird
0
0

Why is it important that a custom expected condition returns a truthy value or a WebElement instead of just True in Selenium Python?

hard📝 Conceptual Q10 of 15
Selenium Python - Advanced Patterns
Why is it important that a custom expected condition returns a truthy value or a WebElement instead of just True in Selenium Python?
AReturning None is the same as returning True
BReturning True causes WebDriverWait to raise an exception
CReturning False is required to stop waiting
DReturning the WebElement allows WebDriverWait to return it for further use
Step-by-Step Solution
Solution:
  1. Step 1: Recall WebDriverWait returns the value from the condition when truthy

    If the condition returns a WebElement, it can be used directly after wait.
  2. Step 2: Understand returning True only signals success but does not provide element

    Returning the element is more useful for chaining actions.
  3. Final Answer:

    Returning the WebElement allows WebDriverWait to return it for further use -> Option D
  4. Quick Check:

    Return WebElement to get it from WebDriverWait [OK]
Quick Trick: Return WebElement to use it after wait [OK]
Common Mistakes:
  • Thinking returning True returns element
  • Confusing False and None meanings
  • Assuming True causes exceptions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes