File tree 2 files changed +563
-41
lines changed
2 files changed +563
-41
lines changed Original file line number Diff line number Diff line change 22
22
23
23
24
24
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
+ """
26
77
27
78
ID = "id"
28
79
XPATH = "xpath"
You can’t perform that action at this time.
0 commit comments