Quality Testing

Quality is delighting customers

What is the difference between Sleep() and setSpeed() ?


This is one of the interview question (faced by my friend in last week), What is the difference between Sleep() and setSpeed() ?



Views: 379

Reply to This

Replies to This Discussion

setSpeed wait for the specified time before every selenium operation takes place. But one sleep() will set up wait only for once.

Thred.sleep :  This will help in resolving sync issues with the objects taking time to load when we use in a for loop waiting for an object. Once the objects is loaded, even though the the max wait time u have given is not reached, ur script will skip the loop and continue with next thereby reducing the script execution time.

setSpeed :  Assume u hv given 5000 ms in setspeed, ur script will halt for 5sec after performing every action(command) even when the object is loaded properly. This will increase ur script execution time. The less Selenium.setspeed time given the better.


TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service