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

Skip to content

Commit 05fd35e

Browse files
authored
Merge pull request baijum#86 from j-n-c/docs_revision
Some Documentation fixes
2 parents aa62a1f + ce6e618 commit 05fd35e

File tree

4 files changed

+47
-48
lines changed

4 files changed

+47
-48
lines changed

source/getting-started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Next, the instance of Firefox WebDriver is created.
5454
The `driver.get` method will navigate to a page given by the URL.
5555
WebDriver will wait until the page has fully loaded (that is, the
5656
"onload" event has fired) before returning control to your test or
57-
script. It's worth noting that if your page uses a lot of AJAX on
58-
load then WebDriver may not know when it has completely loaded.::
57+
script. *Be aware that if your page uses a lot of AJAX on
58+
load then WebDriver may not know when it has completely loaded*::
5959

6060
driver.get("http://www.python.org")
6161

@@ -191,8 +191,8 @@ local reference to the driver object created in `setUp` method.
191191
The `driver.get` method will navigate to a page given by the URL.
192192
WebDriver will wait until the page has fully loaded (that is, the
193193
"onload" event has fired) before returning control to your test or
194-
script. It's worth noting that if your page uses a lot of AJAX on
195-
load then WebDriver may not know when it has completely loaded.::
194+
script. *Be aware that if your page uses a lot of AJAX on
195+
load then WebDriver may not know when it has completely loaded*::
196196

197197
driver.get("http://www.python.org")
198198

source/locating-elements.rst

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ methods to locate elements in a page:
2929

3030

3131
Apart from the public methods given above, there are two private
32-
methods which might be useful with locators in page objects. These
33-
are the two private methods: `find_element` and `find_elements`.
32+
methods which might be useful for locating page elements:
33+
34+
- `find_element`
35+
- `find_elements`
36+
3437

3538
Example usage::
3639

@@ -55,10 +58,10 @@ These are the attributes available for `By` class::
5558
Locating by Id
5659
~~~~~~~~~~~~~~
5760

58-
Use this when you know `id` attribute of an element. With this
59-
strategy, the first element with the `id` attribute value matching the
60-
location will be returned. If no element has a matching `id`
61-
attribute, a ``NoSuchElementException`` will be raised.
61+
Use this when you know the `id` attribute of an element. With this
62+
strategy, the first element with a matching `id` attribute will
63+
be returned. If no element has a matching `id` attribute,
64+
a ``NoSuchElementException`` will be raised.
6265

6366
For instance, consider this page source::
6467

@@ -80,10 +83,10 @@ The form element can be located like this::
8083
Locating by Name
8184
~~~~~~~~~~~~~~~~
8285

83-
Use this when you know `name` attribute of an element. With this
84-
strategy, the first element with the `name` attribute value matching
85-
the location will be returned. If no element has a matching `name`
86-
attribute, a ``NoSuchElementException`` will be raised.
86+
Use this when you know the `name` attribute of an element. With this
87+
strategy, the first element with a matching `name` attribute will
88+
be returned. If no element has a matching `name` attribute,
89+
a ``NoSuchElementException`` will be raised.
8790

8891
For instance, consider this page source::
8992

@@ -115,8 +118,8 @@ Locating by XPath
115118
XPath is the language used for locating nodes in an XML document. As
116119
HTML can be an implementation of XML (XHTML), Selenium users can
117120
leverage this powerful language to target elements in their web
118-
applications. XPath extends beyond (as well as supporting) the simple
119-
methods of locating by id or name attributes, and opens up all sorts
121+
applications. XPath supports the simple methods of locating by
122+
id or name attributes and extends them by opening up all sorts
120123
of new possibilities such as locating the third checkbox on the page.
121124

122125
One of the main reasons for using XPath is when you don't have a
@@ -157,34 +160,30 @@ The form elements can be located like this::
157160

158161
2. First form element in the HTML
159162

160-
3. The form element with attribute named `id` and the value `loginForm`
163+
3. The form element with attribute `id` set to `loginForm`
161164

162165
The username element can be located like this::
163166

164167
username = driver.find_element_by_xpath("//form[input/@name='username']")
165168
username = driver.find_element_by_xpath("//form[@id='loginForm']/input[1]")
166169
username = driver.find_element_by_xpath("//input[@name='username']")
167170

168-
1. First form element with an input child element with attribute named
169-
`name` and the value `username`
171+
1. First form element with an input child element with `name` set to `username`
170172

171-
2. First input child element of the form element with attribute named
172-
`id` and the value `loginForm`
173+
2. First input child element of the form element with attribute `id` set to `loginForm`
173174

174-
3. First input element with attribute named 'name' and the value
175-
`username`
175+
3. First input element with attribute `name` set to `username`
176176

177177
The "Clear" button element can be located like this::
178178

179179
clear_button = driver.find_element_by_xpath("//input[@name='continue'][@type='button']")
180180
clear_button = driver.find_element_by_xpath("//form[@id='loginForm']/input[4]")
181181

182182

183-
1. Input with attribute named `name` and the value `continue` and
184-
attribute named `type` and the value `button`
183+
1. Input with attribute `name` set to `continue` and
184+
attribute `type` set to `button`
185185

186-
2. Fourth input child element of the form element with attribute named
187-
`id` and value `loginForm`
186+
2. Fourth input child element of the form element with attribute `id` set to `loginForm`
188187

189188
These examples cover some basics, but in order to learn more, the
190189
following references are recommended:
@@ -212,9 +211,9 @@ discovering the XPath of an element:
212211
Locating Hyperlinks by Link Text
213212
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214213

215-
Use this when you know link text used within an anchor tag. With this
216-
strategy, the first element with the link text value matching the
217-
location will be returned. If no element has a matching link text
214+
Use this when you know the link text used within an anchor tag. With this
215+
strategy, the first element with the link text matching the provided value
216+
will be returned. If no element has a matching link text
218217
attribute, a ``NoSuchElementException`` will be raised.
219218

220219
For instance, consider this page source::
@@ -258,9 +257,9 @@ The heading (h1) element can be located like this::
258257
Locating Elements by Class Name
259258
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260259

261-
Use this when you want to locate an element by class attribute name.
262-
With this strategy, the first element with the matching class attribute
263-
name will be returned. If no element has a matching class attribute name,
260+
Use this when you want to locate an element by class name.
261+
With this strategy, the first element with the matching class name
262+
attribute will be returned. If no element has a matching class name attribute,
264263
a ``NoSuchElementException`` will be raised.
265264

266265
For instance, consider this page source::
@@ -278,9 +277,9 @@ The "p" element can be located like this::
278277
Locating Elements by CSS Selectors
279278
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280279

281-
Use this when you want to locate an element by CSS selector syntax.
282-
With this strategy, the first element with the matching CSS selector
283-
will be returned. If no element has a matching CSS selector,
280+
Use this when you want to locate an element using CSS selector syntax.
281+
With this strategy, the first element matching the given CSS selector
282+
will be returned. If no element matches the provided CSS selector,
284283
a ``NoSuchElementException`` will be raised.
285284

286285
For instance, consider this page source::

source/navigating.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ link. The normal way to do this is by calling ``get`` method:
1212

1313
WebDriver will wait until the page has fully loaded (that is, the
1414
``onload`` event has fired) before returning control to your test or
15-
script. It's worth noting that if your page uses a lot of AJAX on
16-
load then WebDriver may not know when it has completely loaded. If
15+
script. *Be aware that if your page uses a lot of AJAX on
16+
load then WebDriver may not know when it has completely loaded*. If
1717
you need to ensure such pages are fully loaded then you can use
1818
:ref:`waits <waits>`.
1919

@@ -223,8 +223,8 @@ one browser over another.
223223
Cookies
224224
~~~~~~~
225225

226-
Before we leave these next steps, you may be interested in
227-
understanding how to use cookies. First of all, you need to be on the
226+
Before moving to the next section of the tutorial, you may be interested in
227+
understanding how to use cookies. First of all, you need to be on the
228228
domain that the cookie will be valid for:
229229

230230
::

source/waits.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Waits
44
-----
55

6-
These days most of the web apps are using AJAX techniques. When a
6+
These days, most of the web apps are using AJAX techniques. When a
77
page is loaded by the browser, the elements within that page may load at
88
different time intervals. This makes locating elements difficult: if
99
an element is not yet present in the DOM, a locate function will raise
@@ -47,12 +47,12 @@ accomplished.
4747
driver.quit()
4848

4949

50-
This waits up to 10 seconds before throwing a TimeoutException unless
51-
it finds the element to return within 10 seconds. WebDriverWait
52-
by default calls the ExpectedCondition every 500 milliseconds until it
53-
returns successfully. A successful return is for ExpectedCondition
54-
type is Boolean return true or not null return value for all other
55-
ExpectedCondition types.
50+
In the code above, Selenium will wait for a maximum of 10 seconds for an element
51+
matching the given criteria to be found. If no element is found in that time,
52+
a TimeoutException is thrown. By default, WebDriverWait calls the
53+
ExpectedCondition every 500 milliseconds until it returns success.
54+
ExpectedCondition will return `true` (Boolean) in case of success or `not null`
55+
if it fails to locate an element.
5656

5757
**Expected Conditions**
5858

@@ -127,7 +127,7 @@ Implicit Waits
127127

128128
An implicit wait tells WebDriver to poll the DOM for a certain
129129
amount of time when trying to find any element (or elements)
130-
not immediately available. The default setting is 0. Once set, the
130+
not immediately available. The default setting is 0 (zero). Once set, the
131131
implicit wait is set for the life of the WebDriver object.
132132

133133
::

0 commit comments

Comments
 (0)