Search code examples
pythonseleniumselenium-webdriversleepimplicitwait

Python & Selenium: Difference between driver.implicitly_wait() and time.sleep()


Yes, I know both are used to wait for some specified time.

Selenium:

driver.implicitly_wait(10)

Python:

import time
time.sleep(10)

Is there any difference between these two?


Solution

    • time.sleep(10) pauses code execution exactly 10 seconds.
    • driver.implicitly_wait(10) waits maximum 10 seconds for element's presence. If it is found after 2 seconds then code execution will be continued without wait for more 8 seconds.