Skip to content

Commit e42c609

Browse files
authored
Merge branch 'trunk' into renovate/grpc-java-monorepo
2 parents 820c0c2 + a62ef3d commit e42c609

File tree

2 files changed

+563
-41
lines changed

2 files changed

+563
-41
lines changed

py/selenium/webdriver/common/by.py

+52-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,58 @@
2222

2323

2424
class By:
25-
"""Set of supported locator strategies."""
25+
"""Set of supported locator strategies.
26+
27+
ID:
28+
--
29+
Select the element by its ID.
30+
31+
>>> element = driver.find_element(By.ID, 'myElement')
32+
33+
XPATH:
34+
------
35+
Select the element via XPATH.
36+
- absolute path
37+
- relative path
38+
39+
>>> element = driver.find_element(By.XPATH, '//html/body/div')
40+
41+
LINK_TEXT:
42+
----------
43+
Select the link element having the exact text.
44+
45+
>>> element = driver.find_element(By.LINK_TEXT, 'myLink')
46+
47+
PARTIAL_LINK_TEXT:
48+
------------------
49+
Select the link element having the partial text.
50+
51+
>>> element = driver.find_element(By.PARTIAL_LINK_TEXT, 'my')
52+
53+
NAME:
54+
----
55+
Select the element by its name attribute.
56+
57+
>>> element = driver.find_element(By.NAME, 'myElement')
58+
59+
TAG_NAME:
60+
--------
61+
Select the element by its tag name.
62+
63+
>>> element = driver.find_element(By.TAG_NAME, 'div')
64+
65+
CLASS_NAME:
66+
----------
67+
Select the element by its class name.
68+
69+
>>> element = driver.find_element(By.CLASS_NAME, 'myElement')
70+
71+
CSS_SELECTOR:
72+
-------------
73+
Select the element by its CSS selector.
74+
75+
>>> element = driver.find_element(By.CSS_SELECTOR, 'div.myElement')
76+
"""
2677

2778
ID = "id"
2879
XPATH = "xpath"

0 commit comments

Comments
 (0)