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

Skip to content

Commit fd73729

Browse files
committed
Fix broken links
Line width 79 chars
1 parent 3b22bce commit fd73729

File tree

2 files changed

+59
-62
lines changed

2 files changed

+59
-62
lines changed

source/installation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Other supported browsers will have their own drivers available. Links to some of
5959
| **Safari**: | https://webkit.org/blog/6900/webdriver-support-in-safari-10/ |
6060
+--------------+-----------------------------------------------------------------------+
6161

62+
For more information about driver installation, please refer the `official documentation <https://www.selenium.dev/documentation/en/webdriver/driver_requirements/>`_.
6263

6364
Detailed instructions for Windows users
6465
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/locating-elements.rst

Lines changed: 58 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Locating Elements
44
-----------------
55

6-
There are various strategies to locate elements in a page. You can use
7-
the most appropriate one for your case. Selenium provides the following
8-
methods to locate elements in a page:
6+
There are various strategies to locate elements in a page. You can use the most
7+
appropriate one for your case. Selenium provides the following methods to
8+
locate elements in a page:
99

1010
- `find_element_by_id`
1111
- `find_element_by_name`
@@ -28,8 +28,8 @@ methods to locate elements in a page:
2828
- `find_elements_by_css_selector`
2929

3030

31-
Apart from the public methods given above, there are two private
32-
methods which might be useful for locating page elements:
31+
Apart from the public methods given above, there are two private methods which
32+
might be useful for locating page elements:
3333

3434
- `find_element`
3535
- `find_elements`
@@ -58,10 +58,10 @@ These are the attributes available for `By` class::
5858
Locating by Id
5959
~~~~~~~~~~~~~~
6060

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.
61+
Use this when you know the `id` attribute of an element. With this strategy,
62+
the first element with a matching `id` attribute will be returned. If no
63+
element has a matching `id` attribute, a ``NoSuchElementException`` will be
64+
raised.
6565

6666
For instance, consider this page source::
6767

@@ -83,10 +83,10 @@ The form element can be located like this::
8383
Locating by Name
8484
~~~~~~~~~~~~~~~~
8585

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.
86+
Use this when you know the `name` attribute of an element. With this strategy,
87+
the first element with a matching `name` attribute will be returned. If no
88+
element has a matching `name` attribute, a ``NoSuchElementException`` will be
89+
raised.
9090

9191
For instance, consider this page source::
9292

@@ -115,26 +115,24 @@ button::
115115
Locating by XPath
116116
~~~~~~~~~~~~~~~~~
117117

118-
XPath is the language used for locating nodes in an XML document. As
119-
HTML can be an implementation of XML (XHTML), Selenium users can
120-
leverage this powerful language to target elements in their web
121-
applications. XPath supports the simple methods of locating by
122-
id or name attributes and extends them by opening up all sorts
123-
of new possibilities such as locating the third checkbox on the page.
124-
125-
One of the main reasons for using XPath is when you don't have a
126-
suitable id or name attribute for the element you wish to locate. You
127-
can use XPath to either locate the element in absolute terms (not
128-
advised), or relative to an element that does have an id or name
129-
attribute. XPath locators can also be used to specify elements via
130-
attributes other than id and name.
131-
132-
Absolute XPaths contain the location of all elements from the root
133-
(html) and as a result are likely to fail with only the slightest
134-
adjustment to the application. By finding a nearby element with an id
135-
or name attribute (ideally a parent element) you can locate your
136-
target element based on the relationship. This is much less likely to
137-
change and can make your tests more robust.
118+
XPath is the language used for locating nodes in an XML document. As HTML can
119+
be an implementation of XML (XHTML), Selenium users can leverage this powerful
120+
language to target elements in their web applications. XPath supports the
121+
simple methods of locating by id or name attributes and extends them by opening
122+
up all sorts of new possibilities such as locating the third checkbox on the
123+
page.
124+
125+
One of the main reasons for using XPath is when you don't have a suitable id or
126+
name attribute for the element you wish to locate. You can use XPath to either
127+
locate the element in absolute terms (not advised), or relative to an element
128+
that does have an id or name attribute. XPath locators can also be used to
129+
specify elements via attributes other than id and name.
130+
131+
Absolute XPaths contain the location of all elements from the root (html) and as
132+
a result are likely to fail with only the slightest adjustment to the
133+
application. By finding a nearby element with an id or name attribute (ideally
134+
a parent element) you can locate your target element based on the relationship.
135+
This is much less likely to change and can make your tests more robust.
138136

139137
For instance, consider this page source::
140138

@@ -170,7 +168,8 @@ The username element can be located like this::
170168

171169
1. First form element with an input child element with `name` set to `username`
172170

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

175174
3. First input element with attribute `name` set to `username`
176175

@@ -180,29 +179,27 @@ The "Clear" button element can be located like this::
180179
clear_button = driver.find_element_by_xpath("//form[@id='loginForm']/input[4]")
181180

182181

183-
1. Input with attribute `name` set to `continue` and
184-
attribute `type` set to `button`
182+
1. Input with attribute `name` set to `continue` and attribute `type` set to
183+
`button`
185184

186-
2. Fourth input child element of the form element with attribute `id` set to `loginForm`
185+
2. Fourth input child element of the form element with attribute `id` set to
186+
`loginForm`
187187

188-
These examples cover some basics, but in order to learn more, the
189-
following references are recommended:
188+
These examples cover some basics, but in order to learn more, the following
189+
references are recommended:
190190

191191
* `W3Schools XPath Tutorial <https://www.w3schools.com/xml/xpath_intro.asp>`_
192192
* `W3C XPath Recommendation <http://www.w3.org/TR/xpath>`_
193193
* `XPath Tutorial
194194
<http://www.zvon.org/comp/r/tut-XPath_1.html>`_
195195
- with interactive examples.
196196

197-
There are also a couple of very useful Add-ons that can assist in
198-
discovering the XPath of an element:
197+
Here is a couple of very useful Add-ons that can assist in discovering the XPath
198+
of an element:
199199

200-
* `XPath Checker
201-
<https://addons.mozilla.org/en-US/firefox/addon/xpath-checker/>`_ -
202-
suggests XPath and can be used to test XPath results.
203-
* `Firebug <https://addons.mozilla.org/en-US/firefox/addon/firebug/>`_ -
204-
XPath suggestions are just one of the many powerful features of this
205-
very useful add-on.
200+
* `xPath Finder
201+
<https://addons.mozilla.org/en-US/firefox/addon/xpath_finder>`_ -
202+
Plugin to get the elements xPath.
206203
* `XPath Helper
207204
<https://chrome.google.com/webstore/detail/hgimnogjllphhhkhlmebbmlgjoejdpjl>`_ -
208205
for Google Chrome
@@ -212,9 +209,9 @@ Locating Hyperlinks by Link Text
212209
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213210

214211
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
217-
attribute, a ``NoSuchElementException`` will be raised.
212+
strategy, the first element with the link text matching the provided value will
213+
be returned. If no element has a matching link text attribute, a
214+
``NoSuchElementException`` will be raised.
218215

219216
For instance, consider this page source::
220217

@@ -235,10 +232,9 @@ The continue.html link can be located like this::
235232
Locating Elements by Tag Name
236233
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237234

238-
Use this when you want to locate an element by tag name. With this
239-
strategy, the first element with the given tag name will be returned.
240-
If no element has a matching tag name, a ``NoSuchElementException``
241-
will be raised.
235+
Use this when you want to locate an element by tag name. With this strategy, the
236+
first element with the given tag name will be returned. If no element has a
237+
matching tag name, a ``NoSuchElementException`` will be raised.
242238

243239
For instance, consider this page source::
244240

@@ -257,10 +253,10 @@ The heading (h1) element can be located like this::
257253
Locating Elements by Class Name
258254
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259255

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,
263-
a ``NoSuchElementException`` will be raised.
256+
Use this when you want to locate an element by class name. With this strategy,
257+
the first element with the matching class name attribute will be returned. If
258+
no element has a matching class name attribute, a ``NoSuchElementException``
259+
will be raised.
264260

265261
For instance, consider this page source::
266262

@@ -277,10 +273,10 @@ The "p" element can be located like this::
277273
Locating Elements by CSS Selectors
278274
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
279275

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,
283-
a ``NoSuchElementException`` will be raised.
276+
Use this when you want to locate an element using CSS selector syntax. With
277+
this strategy, the first element matching the given CSS selector will be
278+
returned. If no element matches the provided CSS selector, a
279+
``NoSuchElementException`` will be raised.
284280

285281
For instance, consider this page source::
286282

0 commit comments

Comments
 (0)