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

0 like 0 dislike
1.7k views
in Selenium by
recategorized by

3 Answers

1 like 0 dislike
by
selected by
 
Best answer

Implicit wait --

Implicit wait usually makes browser wait for specified time. This is global setting and it makes WebDriver wait for specified time until all the elements are loaded. In implicit wait, WebDriver will check for source again and again to make sure that element is loaded properly.

Explicit wait--

Explicit wait is limited to perticular WebElement or WebElement to be ready for perticular condition.

e.g. You are looking for text to be equivalent to the texts you are expecting in 60 seconds, you can use Explicit wait.

1 like 0 dislike
by Contributing Tester (32 points)

Implicit Wait: It is set for the entire duration of the webDriver object. Suppose , we want to wait for a certain duration, let's say 10 seconds before each element or a lot of elements on the webpage load. Now, you wouldn't want to write the same code again and again. Hence, implicit wait.

Statement in Selenium for Implicit wait:

Driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Explicit wait: It is an intelligent waits that are confined to a particular web element. Using explicit waits you are basically telling WebDriver at the max it is to wait for X units of time before timedout.

Statement in Selenium for Explicit Wait:

WebDriverWait wait = new WebDriverWait(driver, 10);

WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("someid")));

 

Thanks,

Sanjay

0 like 0 dislike
by Contributing Tester (49 points)

The Difference Between Selenium Waits: Explicit Vs Implicit

Now, since you are aware of the usage of implicit and explicit waits, let us investigate the difference between these 2 Selenium waits:

IMPLICIT WAIT EXPLICIT WAIT
It is by default applied to all the elements in the script. It is applicable to only a certain element that is specific to a certain condition.
We cannot wait based on a specified condition like element selectable/clickable unlike explicit. In explicit, we can specify the wait based on a specific condition.
It is usually used when you are sure the element may be visible at a certain time It is usually used when you are not aware of the time of the element visibility. It is subjected to dynamic nature.


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!

...