Wednesday, 15 January 2014

java - Difference between Wait methods in Selenium and Thread.Sleep -



java - Difference between Wait methods in Selenium and Thread.Sleep -

can please help me understand difference between below 3 waiting methods , efficient utilize in program,

thread.sleep(5000);

driver.manage().timeouts().implicit wait(5, timeunit.seconds);

explicitwait();

thanks

blocking thread block java uses illustration command multithreaded application.

an explicit waits code define wait status occur before proceeding farther in code. worst case of thread.sleep(), sets status exact period of time wait. there convenience methods provided help write code wait long required. webdriverwait in combination expectedcondition 1 way can accomplished.

an implicit wait tell webdriver poll dom amount of time when trying find element or elements if not available. default setting 0. 1 time set, implicit wait set life of webdriver object instance.

you should not utilize java's thread.sleep replacement selenium once, potentially create multithreading errors depending on else within application. (deadlocks example, or race conditions)

java selenium-webdriver

No comments:

Post a Comment