File tree Expand file tree Collapse file tree 1 file changed +52
-1
lines changed
py/selenium/webdriver/common Expand file tree Collapse file tree 1 file changed +52
-1
lines changed Original file line number Diff line number Diff line change 2222
2323
2424class 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"
You can’t perform that action at this time.
0 commit comments