File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,41 @@ Special Keys
109
109
:show-inheritance:
110
110
111
111
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
+
112
147
Firefox WebDriver
113
148
~~~~~~~~~~~~~~~~~
114
149
Original file line number Diff line number Diff line change @@ -28,6 +28,30 @@ methods to locate elements in a page:
28
28
- `find_elements_by_css_selector `
29
29
30
30
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
+
31
55
Locating by Id
32
56
~~~~~~~~~~~~~~
33
57
@@ -270,6 +294,6 @@ For instance, consider this page source::
270
294
The "p" element can be located like this::
271
295
272
296
content = driver.find_element_by_css_selector('p.content')
273
-
297
+
274
298
`Sauce Labs has good documentation <http://saucelabs.com/resources/selenium/css-selectors >`_
275
299
on CSS selectors.
You can’t perform that action at this time.
0 commit comments