0
0
Selenium Pythontesting~5 mins

Time.sleep vs proper waits in Selenium Python - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What does time.sleep() do in Selenium tests?

time.sleep() pauses the test for a fixed number of seconds, no matter what happens on the page.

Click to reveal answer
beginner
What are 'proper waits' in Selenium?

Proper waits are smart waits that pause the test only until a condition is true, like an element appearing, then continue immediately.

Click to reveal answer
intermediate
Why is time.sleep() not recommended for waiting in Selenium tests?

Because it always waits the full time even if the page is ready sooner, making tests slower and less reliable.

Click to reveal answer
beginner
Name two types of proper waits in Selenium.

Implicit Wait and Explicit Wait.

Implicit Wait waits for elements to appear before throwing an error.

Explicit Wait waits for a specific condition before continuing.

Click to reveal answer
intermediate
How does an Explicit Wait improve test speed compared to time.sleep()?

Explicit Wait stops waiting as soon as the condition is met, so tests don’t wait longer than needed.

Click to reveal answer
What happens when you use time.sleep(5) in a Selenium test?
AThe test waits until an element appears or 5 seconds pass.
BThe test pauses exactly 5 seconds no matter what.
CThe test continues immediately without waiting.
DThe test waits only if the page is not loaded.
Which wait type waits only as long as needed for a condition to be true?
AExplicit Wait
BImplicit Wait
Ctime.sleep()
DNo wait
Why might time.sleep() cause tests to be slower?
AIt speeds up the test execution.
BIt skips waiting and causes errors.
CIt waits only for elements to appear.
DIt waits a fixed time even if the page is ready sooner.
Which Selenium wait type is set once and applies to all element searches?
AExplicit Wait
Btime.sleep()
CImplicit Wait
DFluent Wait
What is a key benefit of using proper waits over time.sleep()?
ATests run faster and are more reliable.
BTests always wait the maximum time.
CTests ignore page loading.
DTests never wait for elements.
Explain the difference between time.sleep() and proper waits in Selenium.
Think about how each wait affects test speed and reliability.
You got /3 concepts.
    Describe when you would use Explicit Wait in a Selenium test.
    Consider waiting for elements that load dynamically.
    You got /3 concepts.