The problem appears to be that WebDriverWait attempts to run self._timeout / self._poll times before returning a Timeout Exception:
for _ in xrange(max(1, int(self._timeout/self._poll))):
Since this code could wait until an ElementNotFound exception is found (and if the implicit wait time is increased), then the total time this routine takes is a function of the total # of loops * poll frequency * the implicit wait time.
The correct patch appears to be recording the start time and looping until the maximum timeout period has been exceeded:
--- a/selenium/webdriver/support/wait.py
+++ b/selenium/webdriver/support/wait.py
@@ -24,7 +24,7 @@ class WebDriverWait(object):
def __init__(self, driver, timeout, poll_frequency=POLL_FREQUENCY):
"""Constructor, takes a WebDriver instance and timeout in seconds.
-
+
:Args:
- driver - Instance of WebDriver (Ie, Firefox, Chrome or Remote)
- timeout - Number of seconds before timing out
@@ -43,7 +43,8 @@ class WebDriverWait(object):
def until(self, method):
"""Calls the method provided with the driver as an argument until the \
return value is not Falsy."""
- for _ in xrange(max(1, int(self._timeout/self._poll))):
+ end_time = time.time() + self._timeout
+ while(time.time() < end_time):
try:
value = method(self._driver)
if value:
The bug report is filed here:
http://code.google.com/p/selenium/issues/detail?id=2939
This comment has been removed by the author.
ReplyDeleteHey! You have come to the right place! I am professional writer and I can assist you in any essay related issue! I understand how it is difficult for students to cope with the number of home assignments they are to do. Writing is my pleasure, so for me completing paper for you is quit quick and interesting process, so you even needn't to worry about the deadline date. Moreover, for that students who want to write paper without writer help, on my writing platform cheap-papers where you can easily buy different papers https://cheap-papers.com/buy-a-paper.php or you can find already written articles. And guys do not worry about the price, cause at cheap-papers we produce cheap papers, but this price doesn't affect the excellent quaility of our work, also you will be surprised by the great possibility to save your money just telling your friend to join our writing support team.
ReplyDelete