Permalink
Browse files

use implicitly_wait call to prevent races.

  • Loading branch information...
1 parent ad787af commit 0d41038def1d5966f3831e981ccb03fdde68a112 @hjwp committed Jul 6, 2012
Showing with 10 additions and 0 deletions.
  1. +1 −0 mysite/fts/tests.py
  2. 0 mysite/polls/templates/500.html
  3. +8 −0 tutorial01.rst
  4. +1 −0 tutorial03.rst
View
1 mysite/fts/tests.py
@@ -27,6 +27,7 @@ class PollsTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
+ self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
View
0 mysite/polls/templates/500.html
No changes.
View
8 tutorial01.rst
@@ -227,6 +227,7 @@ have put in there, and replace it with this:
def setUp(self):
self.browser = webdriver.Firefox()
+ self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
@@ -257,6 +258,12 @@ The special methods ``setUp`` and ``tearDown`` are executed before and after
each test. We're using them to start up and shut down our Selenium WebDriver
browser instance.
+The ``implicitly_wait`` call tells webdriver to use a 3-second timeout when
+performing its actions - it doesn't slow things down though, because it's a
+maximum timeout: if Selenium can tell that the page has loaded and any
+javascript processing is done, it will move on before the end..
+
+
Aside from that, there are 3 lines of test code here:
.. sourcecode:: python
@@ -643,6 +650,7 @@ So, we now want our FT to cover logging into the admin site, and checking that
def setUp(self):
self.browser = webdriver.Firefox()
+ self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
View
1 tutorial03.rst
@@ -108,6 +108,7 @@ http://stackoverflow.com/questions/2970608/what-are-named-tuples-in-python)
def setUp(self):
self.browser = webdriver.Firefox()
+ self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()

0 comments on commit 0d41038

Please sign in to comment.