Explicit wait created problem

56 views
Skip to first unread message

Gaurang shah

unread,
May 20, 2013, 8:59:22 AM5/20/13
to webd...@googlegroups.com
Hi Guys, 

I am using webdriver explicit wait, however it is creating more problems for me when time provided is less than 5 seconds. 

following is the code

def waitUntilElementIsPresent(self,locator,time=10):
return WebDriverWait(driver, time).until(lambda driver : driver.find_element_by_xpath(locator))

this works fine if I provide time greater then 10. However if I provide time less than 5 seconds it fails with Timeout Exception. 

Any idea why it's happening so ?? 

Gaurang Shah
 

Tarun Kumar

unread,
May 20, 2013, 11:16:13 PM5/20/13
to webd...@googlegroups.com
May be element is not present with in 5 sec.
Is not this what waitUntilElementIsPresent supposed to be doing any way?

Mark Collin

unread,
May 21, 2013, 3:54:58 AM5/21/13
to webd...@googlegroups.com
I would guess that you have set implicit waits to 10 seconds so the explicit wait times out before the implicit wait you have set returns anything back.

Don't mix implicit and explicit waits.
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gaurang shah

unread,
May 21, 2013, 4:20:54 AM5/21/13
to webd...@googlegroups.com
Hi Mark, 

Where did you fine the implicit wait in the code.What I am saying is if i call the function with 5 seconds in following manner waitUntilElementIsPresent(username,5) 
it says element not found, even though element is present on the page. I took the screenshot after that and it appears in the screenshot. 

If i don't call this function then also other functions (click,type etc..) are able to find the element 

I am not able to understand, What could be the reason due to which this API says element not found though it is present on the page.

Gaurang Shah

Gaurang Shah
Blog: qtp-help.blogspot.com
Mobile: +91 738756556


--
You received this message because you are subscribed to a topic in the Google Groups "webdriver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/webdriver/beF9cSQX0iQ/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to webdriver+...@googlegroups.com.

Mark Collin

unread,
May 21, 2013, 4:45:22 AM5/21/13
to webd...@googlegroups.com
I haven't seen all of your code, I'm making a guess based upon the behavior that you have described.
Reply all
Reply to author
Forward
0 new messages