Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09abf56

Browse files
rogererensbaijum
authored andcommitted
Improve the explanation of waits
1 parent a378676 commit 09abf56

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

source/waits.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ Waits
44
-----
55

66
These days most of the web apps are using AJAX techniques. When a
7-
page is loaded to browser, the elements within that page may load at
8-
different time intervals. This makes locating elements difficult, if
9-
the element is not present in the DOM, it will raise
10-
`ElementNotVisibleException` exception. Using waits, we can solve
11-
this issue. Waiting provides some time interval between actions
12-
performed - mostly locating element or any other operation with the
7+
page is loaded by the browser, the elements within that page may load at
8+
different time intervals. This makes locating elements difficult: if
9+
an element is not yet present in the DOM, a locate function will raise
10+
an `ElementNotVisibleException` exception. Using waits, we can solve
11+
this issue. Waiting provides some slack between actions
12+
performed - mostly locating an element or any other operation with the
1313
element.
1414

1515
Selenium Webdriver provides two types of waits - implicit & explicit.
16-
An explicit wait makes WebDriver to wait for a certain condition to
17-
occur before proceeding further with executions. An implicit wait
18-
makes WebDriver to poll the DOM for a certain amount of time when
16+
An explicit wait makes WebDriver wait for a certain condition to
17+
occur before proceeding further with execution. An implicit wait
18+
makes WebDriver poll the DOM for a certain amount of time when
1919
trying to locate an element.
2020

2121

2222
Explicit Waits
2323
~~~~~~~~~~~~~~
2424

2525
An explicit wait is code you define to wait for a certain condition
26-
to occur before proceeding further in the code. The worst case of
26+
to occur before proceeding further in the code. The extreme case of
2727
this is time.sleep(), which sets the condition to an exact time period
2828
to wait. There are some convenience methods provided that help you
2929
write code that will wait only as long as required. WebDriverWait in
@@ -47,17 +47,17 @@ accomplished.
4747
driver.quit()
4848

4949

50-
This waits up to 10 seconds before throwing a TimeoutException or if
51-
it finds the element will return it in 0 - 10 seconds. WebDriverWait
50+
This waits up to 10 seconds before throwing a TimeoutException unless
51+
it finds the element to return within 10 seconds. WebDriverWait
5252
by default calls the ExpectedCondition every 500 milliseconds until it
5353
returns successfully. A successful return is for ExpectedCondition
5454
type is Boolean return true or not null return value for all other
5555
ExpectedCondition types.
5656

5757
**Expected Conditions**
5858

59-
There are some common conditions that are frequent when
60-
automating web browsers. Listed below are Implementations of
59+
There are some common conditions that are frequently of use when
60+
automating web browsers. Listed below are the names of
6161
each. Selenium Python binding provides some convienence methods so you
6262
don't have to code an expected_condition class yourself or create your
6363
own utility package for them.
@@ -72,7 +72,7 @@ own utility package for them.
7272
- text_to_be_present_in_element_value
7373
- frame_to_be_available_and_switch_to_it
7474
- invisibility_of_element_located
75-
- element_to_be_clickable - it is Displayed and Enabled.
75+
- element_to_be_clickable
7676
- staleness_of
7777
- element_to_be_selected
7878
- element_located_to_be_selected
@@ -85,7 +85,7 @@ own utility package for them.
8585
from selenium.webdriver.support import expected_conditions as EC
8686

8787
wait = WebDriverWait(driver, 10)
88-
element = wait.until(EC.element_to_be_clickable((By.ID,'someid')))
88+
element = wait.until(EC.element_to_be_clickable((By.ID, 'someid')))
8989

9090
The expected_conditions module contains a set of predefined conditions
9191
to use with WebDriverWait.
@@ -94,10 +94,10 @@ to use with WebDriverWait.
9494
Implicit Waits
9595
~~~~~~~~~~~~~~
9696

97-
An implicit wait is to tell WebDriver to poll the DOM for a certain
98-
amount of time when trying to find an element or elements if they are
97+
An implicit wait tells WebDriver to poll the DOM for a certain
98+
amount of time when trying to find any element (or elements)
9999
not immediately available. The default setting is 0. Once set, the
100-
implicit wait is set for the life of the WebDriver object instance.
100+
implicit wait is set for the life of the WebDriver object.
101101

102102
::
103103

0 commit comments

Comments
 (0)