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

Skip to content

Commit 8406736

Browse files
author
Baiju Muthukadan
committed
expand API with more common APIs
1 parent 631f1c2 commit 8406736

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

source/api.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,41 @@ Special Keys
109109
:show-inheritance:
110110

111111

112+
Locate elements By
113+
~~~~~~~~~~~~~~~~~~
114+
115+
These are the attributes which can be used to locate elements. See
116+
the :ref:`locating-elements` chapter for example usages.
117+
118+
.. automodule:: selenium.webdriver.common.by
119+
:members:
120+
:undoc-members:
121+
:member-order: groupwise
122+
:show-inheritance:
123+
124+
125+
Desired Capabilities
126+
~~~~~~~~~~~~~~~~~~~~
127+
128+
See the :ref:`selenium-remote-webdriver` section for example usages of desired capabilities.
129+
130+
.. automodule:: selenium.webdriver.common.desired_capabilities
131+
:members:
132+
:undoc-members:
133+
:member-order: groupwise
134+
:show-inheritance:
135+
136+
137+
Utilities
138+
~~~~~~~~~
139+
140+
.. automodule:: selenium.webdriver.common.utils
141+
:members:
142+
:undoc-members:
143+
:member-order: groupwise
144+
:show-inheritance:
145+
146+
112147
Firefox WebDriver
113148
~~~~~~~~~~~~~~~~~
114149

source/locating-elements.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,30 @@ 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 with locators in page objects. These
33+
are the two private methods: `find_element` and `find_elements`.
34+
35+
Example usage::
36+
37+
from selenium.webdriver.common.by import By
38+
39+
driver.find_element(By.XPATH, '//button[text()="Some text"]')
40+
driver.find_elements(By.XPATH, '//button')
41+
42+
43+
These are the attributes available for `By` class::
44+
45+
ID = "id"
46+
XPATH = "xpath"
47+
LINK_TEXT = "link text"
48+
PARTIAL_LINK_TEXT = "partial link text"
49+
NAME = "name"
50+
TAG_NAME = "tag name"
51+
CLASS_NAME = "class name"
52+
CSS_SELECTOR = "css selector"
53+
54+
3155
Locating by Id
3256
~~~~~~~~~~~~~~
3357

@@ -270,6 +294,6 @@ For instance, consider this page source::
270294
The "p" element can be located like this::
271295

272296
content = driver.find_element_by_css_selector('p.content')
273-
297+
274298
`Sauce Labs has good documentation <http://saucelabs.com/resources/selenium/css-selectors>`_
275299
on CSS selectors.

0 commit comments

Comments
 (0)