Edited testing.txt changes from [17283]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17306 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
103890561b
commit
32ee74f89e
|
@ -1870,16 +1870,16 @@ out the `full reference`_ for more details.
|
||||||
|
|
||||||
When using an in-memory SQLite database to run the tests, the same database
|
When using an in-memory SQLite database to run the tests, the same database
|
||||||
connection will be shared by two threads in parallel: the thread in which
|
connection will be shared by two threads in parallel: the thread in which
|
||||||
the live server is run, and the thread in which the test case is run. It is
|
the live server is run and the thread in which the test case is run. It's
|
||||||
important to prevent simultaneous database queries via this shared
|
important to prevent simultaneous database queries via this shared
|
||||||
connection by the two threads as that may sometimes cause the tests to
|
connection by the two threads, as that may sometimes randomly cause the
|
||||||
randomly fail. So you need to ensure that the two threads do not access the
|
tests to fail. So you need to ensure that the two threads don't access the
|
||||||
database at the same time. In particular, this means that in some cases
|
database at the same time. In particular, this means that in some cases
|
||||||
(for example just after clicking a link or submitting a form) you might
|
(for example, just after clicking a link or submitting a form), you might
|
||||||
need to check that a response is received by Selenium and that the next
|
need to check that a response is received by Selenium and that the next
|
||||||
page is loaded before proceeding further with the execution of the tests.
|
page is loaded before proceeding with further test execution.
|
||||||
This can be achieved, for example, by making Selenium wait until the
|
Do this, for example, by making Selenium wait until the `<body>` HTML tag
|
||||||
`<body>` HTML tag is found in the response (requires Selenium > 2.13):
|
is found in the response (requires Selenium > 2.13):
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
@ -1891,13 +1891,12 @@ out the `full reference`_ for more details.
|
||||||
WebDriverWait(self.selenium, timeout).until(
|
WebDriverWait(self.selenium, timeout).until(
|
||||||
lambda driver: driver.find_element_by_tag_name('body'), timeout=10)
|
lambda driver: driver.find_element_by_tag_name('body'), timeout=10)
|
||||||
|
|
||||||
The difficult point is that there really is no such thing as a "page load",
|
The tricky thing here is that there's really no such thing as a "page load,"
|
||||||
especially in modern Web apps that have dynamically-generated page
|
especially in modern Web apps that generate HTML dynamically after the
|
||||||
components that do not exist in the HTML initially received from the
|
server generates the initial document. So, simply checking for the presence
|
||||||
server. So simply checking for the presence of the `<body>` tag in the
|
of `<body>` in the response might not necessarily be appropriate for all
|
||||||
response might not necessarily be appropriate for all use cases. Please
|
use cases. Please refer to the `Selenium FAQ`_ and
|
||||||
refer to the `Selenium FAQ`_ and the `Selenium documentation`_ for more
|
`Selenium documentation`_ for more information.
|
||||||
information on this topic.
|
|
||||||
|
|
||||||
.. _Selenium FAQ: http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_WebDriver_fails_to_find_elements_/_Does_not_block_on_page_loa
|
.. _Selenium FAQ: http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_WebDriver_fails_to_find_elements_/_Does_not_block_on_page_loa
|
||||||
.. _Selenium documentation: http://seleniumhq.org/docs/04_webdriver_advanced.html#explicit-waits
|
.. _Selenium documentation: http://seleniumhq.org/docs/04_webdriver_advanced.html#explicit-waits
|
||||||
|
|
Loading…
Reference in New Issue