Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
1.8k views
by The go-to Tester (232 points)
retagged by
What is the difference between setSpeed() and sleep() methods? Please help to show some ways!

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

When you do setSleep is used, the selenium instance will execute with regular interval specified.

Eg.

selenium.setSpeed(1000);

selenium.click("Element  1");

selenium.click("Element  2");

selenium.click("Element  2");

The click will execute at the interval of 1 sec.

 

Now if you use Thread.sleep.

Eg.

selenium.click("Element  1");

Thread.sleep(1000);

selenium.click("Element  2");

selenium.click("Element  2");

There will be just one one second interval between click of an element 1 and element two.

So, setSpeed is roughly equivalent to

selenium.click("Element  1");

Thread.sleep(1000);

selenium.click("Element  2");

Thread.sleep(1000);

selenium.click("Element  2");

Hope that answered!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...