difference between Implicit Wait and Explicit Wait with syntax.?

Answer Posted / surajsingh rajput

Both are part of Synchronization in Java.
there are different type of synchronization
- thread.sleep()
- Implicit wait
- Explicit wait
- Fluent wait
IMPLICIT WAIT -
we use this wait to apply globally, we can write this in our base class and use in whole framework.it is default applicable for execution of each line.
Syntax -
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

EXPLICIT WAIT -
we use this wait to apply for particular condition, we can write this in execution flow.it is applicable only for given condition and only single time per deceleration.
Syntax -
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.[CONDITION]);


Note- remember one thing implicit wait always dominates explicit wait.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is driver.close()command different from driver.quit command?

493


What is a node in selenium grid?

553


What is a fundamental difference between xpath and css selector?

499


How to mouse hover on a web element using webdriver?

459


What kinds of tests can Selenium support?

566






What are some of the advantages of selenium grid?

504


Which is the command used for displaying the values of a variable into the output console or log?

495


Mention 5 different exceptions you had in selenium web driver?

474


How to perform right click using selenium webdriver?

448


How to scroll down to a particular element?

3156


How can we find the value of different attributes like name, class, the value of an element?

445


What are the drawbacks of selenium ide

492


How to handle hidden elements in selenium webdriver?

501


What does a right-pointing green triangle at the beginning of a command in side indicate?

1000


Is there a way to refresh browser using selenium?

500