Checking my understanding of implicit and explicit waits

81 views
Skip to first unread message

CS_FAN

unread,
Mar 5, 2016, 10:38:28 PM3/5/16
to Selenium Users
Hello,

Below is my understanding of the two types of waits.  Am I correct?

Explicit wait waits for an element to appear in a specified time span.  If it appears within the time span, the automated task continues immediately.  If it doesn't appear in that time span, it will timeout.

Implicit wait polls the DOM in a specified time span.  If the element appears within the time span, the automated task continues immediately.  If it doesn't appear in that time span, it will timeout.

What's the difference between waiting for an element to appear, as opposed to polling the DOM until the element is present?

Thanks

saurabh verma

unread,
Mar 6, 2016, 12:59:31 PM3/6/16
to seleniu...@googlegroups.com
Implicit waits poll the dom i.e.,(search the DOM in recursive manner in specified time intervals ) poll means as part of a repeated cycle.
for example : Dom is checked for Presence of elements every 5 sec in a period of 25 sec.
and Explicit wait hold directly for specified amount of time and the check the availability of elements
i.e., Once after holding DOM for 25 sec.





Greetings,
SaurabhV
9665987601

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5828ef8f-522d-450f-b1f7-aaa9ea44ed86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shawn McCarthy

unread,
Mar 6, 2016, 5:43:34 PM3/6/16
to Selenium Users
With implicit wait, you are specifically waiting for that element to be available. With explicit wait, you don't have to wait for that specific element to be available. For example,
If you click an Edit button, you may expect a cancel or save button to appear, so you can add an explicit wait to wait for one of those buttons to appear after clicking the Edit button.

Amir Mahallati

unread,
Mar 8, 2016, 1:48:00 AM3/8/16
to seleniu...@googlegroups.com
Why would I want to poll the DOM, if I can wait for only a particular element to appear explicitly?  They both seem to accomplish the same thing.  Please correct me if I am wrong, but it's analogous to going to New York with a Sedan, as opposed to going there with a SUV.  They can both take you to New York in the same amount of time.  The only difference is in the structures of the two cars.

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Stephen Chownwai

unread,
Mar 14, 2016, 10:23:41 PM3/14/16
to Selenium Users
So I use explicit waits on things I know will take time to load to keep my implicit time low. 

So for example if I click a button to upload an image, it opens in an iframe, then I have to wait for any previously uploaded images to appear and then click on one of the images after they have finished loading and then submit it. Maybe the images take 30 seconds to load for some reason, I can just write an explicit wait for just that object. Otherwise id have to put in an implicit wait of 30 seconds in my setup and now every object in every test will now take 30 seconds.

Explicit is good for targeting specific conditions without blowing up your implicit waits. You could also just only use explicit waits and just never use implicit, but I guess it depends on the situation.

Stephen Chownwai

unread,
Mar 14, 2016, 10:23:50 PM3/14/16
to Selenium Users
because it can keep your implicit waits low. It is situational, if you have an object that takes maybe 20 seconds to load (maybe a bunch of images in a media library you want to use?) then you can use an explicit wait on specifically that object instead of making your blanket implicit wait 20+ seconds.

It can keep your tests quick as possible. Again though, i think it is situational.


On Tuesday, March 8, 2016 at 1:48:00 AM UTC-5, CS_FAN wrote:
Reply all
Reply to author
Forward
0 new messages