robo_appian 0.0.11__py3-none-any.whl → 0.0.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of robo_appian might be problematic. Click here for more details.
- robo_appian/components/ButtonUtils.py +64 -10
- robo_appian/components/DateUtils.py +43 -111
- robo_appian/components/DropdownUtils.py +117 -5
- robo_appian/components/InputUtils.py +83 -47
- robo_appian/components/LabelUtils.py +22 -30
- robo_appian/components/LinkUtils.py +9 -9
- robo_appian/components/SearchDropdownUtils.py +1 -1
- robo_appian/components/SearchInputUtils.py +23 -28
- robo_appian/components/TabUtils.py +24 -29
- robo_appian/components/TableUtils.py +42 -77
- robo_appian/controllers/ComponentDriver.py +4 -4
- robo_appian/utils/ComponentUtils.py +71 -112
- robo_appian-0.0.13.dist-info/METADATA +67 -0
- robo_appian-0.0.13.dist-info/RECORD +22 -0
- robo_appian-0.0.11.dist-info/METADATA +0 -140
- robo_appian-0.0.11.dist-info/RECORD +0 -22
- {robo_appian-0.0.11.dist-info → robo_appian-0.0.13.dist-info}/LICENSE +0 -0
- {robo_appian-0.0.11.dist-info → robo_appian-0.0.13.dist-info}/WHEEL +0 -0
|
@@ -4,8 +4,30 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class ButtonUtils:
|
|
7
|
+
"""
|
|
8
|
+
Utility class for interacting with button components in Appian UI.
|
|
9
|
+
Usage Example:
|
|
10
|
+
# Click a button by its label
|
|
11
|
+
from robo_appian.components.ButtonUtils import ButtonUtils
|
|
12
|
+
ButtonUtils.clickByLabelText(wait, "Submit")
|
|
13
|
+
"""
|
|
14
|
+
|
|
7
15
|
@staticmethod
|
|
8
|
-
def
|
|
16
|
+
def __findByPartialLabelText(wait: WebDriverWait, label: str):
|
|
17
|
+
"""
|
|
18
|
+
Finds a button by its label.
|
|
19
|
+
|
|
20
|
+
Parameters:
|
|
21
|
+
wait: Selenium WebDriverWait instance.
|
|
22
|
+
label: The label of the button to find.
|
|
23
|
+
label: The label of the button to find.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
WebElement representing the button.
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
component = ButtonUtils.__findByLabelText(wait, "Submit")
|
|
30
|
+
"""
|
|
9
31
|
xpath = f".//button[./span[contains(translate(normalize-space(.), '\u00a0', ' '), '{label}')]]"
|
|
10
32
|
try:
|
|
11
33
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
@@ -14,22 +36,56 @@ class ButtonUtils:
|
|
|
14
36
|
return component
|
|
15
37
|
|
|
16
38
|
@staticmethod
|
|
17
|
-
def
|
|
39
|
+
def __findByLabelText(wait: WebDriverWait, label: str):
|
|
18
40
|
"""
|
|
19
|
-
|
|
41
|
+
Finds a button by its label.
|
|
20
42
|
|
|
21
43
|
Parameters:
|
|
22
44
|
wait: Selenium WebDriverWait instance.
|
|
23
|
-
label: The
|
|
45
|
+
label: The label of the button to find.
|
|
46
|
+
label: The label of the button to find.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
WebElement representing the button.
|
|
50
|
+
|
|
24
51
|
Example:
|
|
25
|
-
ButtonUtils.
|
|
52
|
+
component = ButtonUtils.__findByLabelText(wait, "Submit")
|
|
53
|
+
"""
|
|
54
|
+
xpath = f".//button[./span[normalize-space(text())='{label}']]"
|
|
55
|
+
try:
|
|
56
|
+
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
57
|
+
except Exception as e:
|
|
58
|
+
raise RuntimeError(f"Button with label '{label}' not found or not clickable.") from e
|
|
59
|
+
return component
|
|
60
|
+
|
|
61
|
+
@staticmethod
|
|
62
|
+
def clickByPartialLabelText(wait: WebDriverWait, label: str):
|
|
63
|
+
"""Finds a button by its partial label and clicks it.
|
|
64
|
+
|
|
65
|
+
Parameters:
|
|
66
|
+
wait: Selenium WebDriverWait instance.
|
|
67
|
+
label: The partial label of the button to click.
|
|
68
|
+
Example:
|
|
69
|
+
ButtonUtils.clickByPartialLabelText(wait, "Button Label")
|
|
70
|
+
"""
|
|
71
|
+
component = ButtonUtils.__findByPartialLabelText(wait, label)
|
|
72
|
+
component.click()
|
|
26
73
|
|
|
74
|
+
@staticmethod
|
|
75
|
+
def clickByLabelText(wait: WebDriverWait, label: str):
|
|
76
|
+
"""Finds a button by its label and clicks it.
|
|
77
|
+
|
|
78
|
+
Parameters:
|
|
79
|
+
wait: Selenium WebDriverWait instance.
|
|
80
|
+
label: The label of the button to click.
|
|
81
|
+
Example:
|
|
82
|
+
ButtonUtils.clickByLabelText(wait, "Button Label")
|
|
27
83
|
"""
|
|
28
|
-
component = ButtonUtils.
|
|
84
|
+
component = ButtonUtils.__findByLabelText(wait, label)
|
|
29
85
|
component.click()
|
|
30
86
|
|
|
31
87
|
@staticmethod
|
|
32
|
-
def
|
|
88
|
+
def clickById(wait: WebDriverWait, id: str):
|
|
33
89
|
"""
|
|
34
90
|
Finds and clicks an input button by its HTML id attribute.
|
|
35
91
|
|
|
@@ -38,13 +94,11 @@ class ButtonUtils:
|
|
|
38
94
|
id: The HTML id of the input button.
|
|
39
95
|
|
|
40
96
|
Example:
|
|
41
|
-
ButtonUtils.
|
|
97
|
+
ButtonUtils.clickById(wait, "button_id")
|
|
42
98
|
|
|
43
99
|
"""
|
|
44
100
|
try:
|
|
45
101
|
component = wait.until(EC.element_to_be_clickable((By.ID, id)))
|
|
46
|
-
except TimeoutError as e:
|
|
47
|
-
raise TimeoutError(f"Input button with id '{id}' not found or not clickable.") from e
|
|
48
102
|
except Exception as e:
|
|
49
103
|
raise RuntimeError(f"Input button with id '{id}' not found or not clickable.") from e
|
|
50
104
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from selenium.webdriver.common.by import By
|
|
2
2
|
from selenium.webdriver.support import expected_conditions as EC
|
|
3
3
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
4
|
-
from selenium.webdriver.remote.webelement import WebElement
|
|
5
4
|
|
|
6
5
|
from robo_appian.components.InputUtils import InputUtils
|
|
7
6
|
|
|
@@ -9,137 +8,70 @@ from robo_appian.components.InputUtils import InputUtils
|
|
|
9
8
|
class DateUtils:
|
|
10
9
|
"""
|
|
11
10
|
Utility class for interacting with date components in Appian UI.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# Set a date value
|
|
11
|
+
Usage Example:
|
|
12
|
+
# Set a date value in a date component
|
|
16
13
|
from robo_appian.components.DateUtils import DateUtils
|
|
17
|
-
DateUtils.
|
|
18
|
-
|
|
14
|
+
DateUtils.setValueByLabelText(wait, "Start Date", "2023-10-01")
|
|
19
15
|
"""
|
|
20
16
|
|
|
21
17
|
@staticmethod
|
|
22
|
-
def
|
|
18
|
+
def __findComponent(wait: WebDriverWait, label: str):
|
|
23
19
|
"""
|
|
24
20
|
Finds a date component by its label.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
label: The visible text label of the date component.
|
|
29
|
-
|
|
30
|
-
Returns:
|
|
31
|
-
The Selenium WebElement for the date component.
|
|
32
|
-
|
|
21
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
22
|
+
:param label: The label of the date component.
|
|
23
|
+
:return: The WebElement representing the date component.
|
|
33
24
|
Example:
|
|
34
|
-
DateUtils.
|
|
35
|
-
|
|
25
|
+
DateUtils.__findComponent(wait, "Start Date")
|
|
36
26
|
"""
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if component_id is None:
|
|
55
|
-
raise ValueError(
|
|
56
|
-
f"Could not find component using {attribute} attribute for label '{label}'."
|
|
57
|
-
)
|
|
58
|
-
|
|
27
|
+
# xpath = f".//div/label[text()='{label}']"
|
|
28
|
+
# try:
|
|
29
|
+
# component: WebElement = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
30
|
+
# except Exception as e:
|
|
31
|
+
# raise Exception(f"Could not find clickable date component with label '{label}': {e}")
|
|
32
|
+
|
|
33
|
+
# attribute: str = "for"
|
|
34
|
+
# component_id = component.get_attribute(attribute) # type: ignore[reportUnknownMemberType]
|
|
35
|
+
# if component_id is None:
|
|
36
|
+
# raise ValueError(f"Could not find component using {attribute} attribute for label '{label}'.")
|
|
37
|
+
|
|
38
|
+
# try:
|
|
39
|
+
# component = wait.until(EC.element_to_be_clickable((By.ID, component_id)))
|
|
40
|
+
# except Exception as e:
|
|
41
|
+
# raise Exception(f"Could not find clickable date input with id '{component_id}': {e}")
|
|
42
|
+
|
|
43
|
+
xpath = f'.//div[./div/label[text()="{label}"]]/div/div/div/input'
|
|
59
44
|
try:
|
|
60
|
-
component = wait.until(EC.element_to_be_clickable((By.
|
|
61
|
-
except TimeoutError as e:
|
|
62
|
-
raise TimeoutError(
|
|
63
|
-
f"Could not find clickable date input with id '{component_id}': {e}"
|
|
64
|
-
)
|
|
45
|
+
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
65
46
|
except Exception as e:
|
|
66
|
-
raise Exception(
|
|
67
|
-
f"Could not find clickable date input with id '{component_id}': {e}"
|
|
68
|
-
)
|
|
47
|
+
raise Exception(f"Could not find clickable date component with label '{label}': {e}")
|
|
69
48
|
return component
|
|
70
49
|
|
|
71
50
|
@staticmethod
|
|
72
|
-
def
|
|
51
|
+
def setValueByLabelText(wait: WebDriverWait, label: str, value: str):
|
|
73
52
|
"""
|
|
74
|
-
Sets
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
value: The date value to set (e.g., "01/01/2024").
|
|
80
|
-
|
|
81
|
-
Returns:
|
|
82
|
-
The Selenium WebElement for the date component after setting the value.
|
|
83
|
-
|
|
53
|
+
Sets the value of a date component.
|
|
54
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
55
|
+
:param label: The label of the date component.
|
|
56
|
+
:param value: The value to set in the date component.
|
|
57
|
+
:return: The WebElement representing the date component.
|
|
84
58
|
Example:
|
|
85
|
-
DateUtils.
|
|
86
|
-
|
|
59
|
+
DateUtils.setValueByLabelText(wait, "Start Date", "2023-10-01")
|
|
87
60
|
"""
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# component = wait.until(EC.element_to_be_clickable((By.XPATH, f".//div/label[text()='{label}']/following-sibling::input")))
|
|
91
|
-
|
|
92
|
-
component = DateUtils.findComponent(wait, label)
|
|
93
|
-
InputUtils._setComponentValue(component, value)
|
|
61
|
+
component = DateUtils.__findComponent(wait, label)
|
|
62
|
+
InputUtils._setValueByComponent(component, value)
|
|
94
63
|
return component
|
|
95
64
|
|
|
96
65
|
@staticmethod
|
|
97
|
-
def
|
|
66
|
+
def clickByLabelText(wait: WebDriverWait, label: str):
|
|
98
67
|
"""
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
label: The visible text label of the date component.
|
|
104
|
-
value: The date value to set (e.g., "01/01/2024").
|
|
105
|
-
|
|
106
|
-
Returns:
|
|
107
|
-
The Selenium WebElement for the date component after setting the value.
|
|
108
|
-
|
|
68
|
+
Clicks on the date component to open the date picker.
|
|
69
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
70
|
+
:param label: The label of the date component.
|
|
71
|
+
:return: The WebElement representing the date component.
|
|
109
72
|
Example:
|
|
110
|
-
DateUtils.
|
|
111
|
-
|
|
73
|
+
DateUtils.clickByLabelText(wait, "Start Date")
|
|
112
74
|
"""
|
|
113
|
-
|
|
114
|
-
# This method locates a date component that contains a label with the specified text.
|
|
115
|
-
# It then retrieves the component's ID and uses it to find the actual input element.
|
|
116
|
-
# It sets the value of the input element and submits it.
|
|
117
|
-
|
|
118
|
-
component = DateUtils.findComponent(wait, label)
|
|
119
|
-
InputUtils.setValueAndSubmitByComponent(component, value)
|
|
120
|
-
|
|
121
|
-
return component
|
|
122
|
-
|
|
123
|
-
@staticmethod
|
|
124
|
-
def click(wait: WebDriverWait, label: str):
|
|
125
|
-
"""
|
|
126
|
-
Clicks on a date component identified by its label.
|
|
127
|
-
|
|
128
|
-
Parameters:
|
|
129
|
-
wait: Selenium WebDriverWait instance.
|
|
130
|
-
label: The visible text label of the date component.
|
|
131
|
-
|
|
132
|
-
Returns:
|
|
133
|
-
The Selenium WebElement for the date component after clicking.
|
|
134
|
-
|
|
135
|
-
Example:
|
|
136
|
-
DateUtils.click(wait, "Start Date")
|
|
137
|
-
"""
|
|
138
|
-
# This method locates a date component that contains a label with the specified text.
|
|
139
|
-
# It then retrieves the component's ID and uses it to find the actual input element.
|
|
140
|
-
# It clicks on the input element to open the date picker.
|
|
141
|
-
|
|
142
|
-
component = DateUtils.findComponent(wait, label)
|
|
75
|
+
component = DateUtils.__findComponent(wait, label)
|
|
143
76
|
component.click()
|
|
144
|
-
|
|
145
77
|
return component
|
|
@@ -16,7 +16,16 @@ class DropdownUtils:
|
|
|
16
16
|
|
|
17
17
|
@staticmethod
|
|
18
18
|
def __findComboboxByPartialLabelText(wait: WebDriverWait, label: str):
|
|
19
|
-
|
|
19
|
+
"""
|
|
20
|
+
Finds a combobox by its partial label text.
|
|
21
|
+
|
|
22
|
+
:param wait: Selenium WebDriverWait instance.
|
|
23
|
+
:param label: The partial label of the combobox to find.
|
|
24
|
+
:return: WebElement representing the combobox.
|
|
25
|
+
Example:
|
|
26
|
+
component = DropdownUtils.__findComboboxByPartialLabelText(wait, "Dropdown Label")
|
|
27
|
+
"""
|
|
28
|
+
xpath = f'.//div[./div/span[contains(normalize-space(text()), "{label}")]]/div/div/div/div[@role="combobox" and not(@aria-disabled="true")]' # noqa: E501
|
|
20
29
|
try:
|
|
21
30
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
22
31
|
except Exception as e:
|
|
@@ -26,7 +35,16 @@ class DropdownUtils:
|
|
|
26
35
|
|
|
27
36
|
@staticmethod
|
|
28
37
|
def __findComboboxByLabelText(wait: WebDriverWait, label: str):
|
|
29
|
-
|
|
38
|
+
"""
|
|
39
|
+
Finds a combobox by its label text.
|
|
40
|
+
|
|
41
|
+
:param wait: Selenium WebDriverWait instance.
|
|
42
|
+
:param label: The label of the combobox to find.
|
|
43
|
+
:return: WebElement representing the combobox.
|
|
44
|
+
Example:
|
|
45
|
+
component = DropdownUtils.__findComboboxByLabelText(wait, "Dropdown Label")
|
|
46
|
+
"""
|
|
47
|
+
xpath = f'.//div[./div/span[normalize-space(text())="{label}"]]/div/div/div/div[@role="combobox" and not(@aria-disabled="true")]' # noqa: E501
|
|
30
48
|
try:
|
|
31
49
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
32
50
|
except Exception as e:
|
|
@@ -36,10 +54,27 @@ class DropdownUtils:
|
|
|
36
54
|
|
|
37
55
|
@staticmethod
|
|
38
56
|
def __clickCombobox(wait: WebDriverWait, combobox: WebElement):
|
|
57
|
+
"""
|
|
58
|
+
Clicks the combobox to open the dropdown options.
|
|
59
|
+
|
|
60
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
61
|
+
:param combobox: The combobox WebElement.
|
|
62
|
+
Example:
|
|
63
|
+
DropdownUtils.__clickCombobox(wait, combobox)
|
|
64
|
+
"""
|
|
39
65
|
combobox.click()
|
|
40
66
|
|
|
41
67
|
@staticmethod
|
|
42
68
|
def __findDropdownOptionId(wait: WebDriverWait, combobox: WebElement):
|
|
69
|
+
"""
|
|
70
|
+
Finds the dropdown option id from the combobox.
|
|
71
|
+
|
|
72
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
73
|
+
:param combobox: The combobox WebElement.
|
|
74
|
+
:return: The id of the dropdown options list.
|
|
75
|
+
Example:
|
|
76
|
+
dropdown_option_id = DropdownUtils.__findDropdownOptionId(wait, combobox)
|
|
77
|
+
"""
|
|
43
78
|
dropdown_option_id = combobox.get_attribute("aria-controls")
|
|
44
79
|
if dropdown_option_id is None:
|
|
45
80
|
raise Exception('Dropdown component does not have a valid "aria-controls" attribute.')
|
|
@@ -47,9 +82,23 @@ class DropdownUtils:
|
|
|
47
82
|
|
|
48
83
|
@staticmethod
|
|
49
84
|
def __checkDropdownOptionValueExistsByDropdownOptionId(wait: WebDriverWait, dropdown_option_id: str, value: str):
|
|
50
|
-
|
|
85
|
+
"""
|
|
86
|
+
Checks if a dropdown option value exists by its option id and value.
|
|
87
|
+
|
|
88
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
89
|
+
:param dropdown_option_id: The id of the dropdown options list.
|
|
90
|
+
:param value: The value to check in the dropdown.
|
|
91
|
+
Example:
|
|
92
|
+
exists = DropdownUtils.checkDropdownOptionValueExistsByDropdownOptionId(wait, "dropdown_option_id", "Option Value")
|
|
93
|
+
if exists:
|
|
94
|
+
print("The value exists in the dropdown.")
|
|
95
|
+
else:
|
|
96
|
+
print("The value does not exist in the dropdown.")
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
xpath = f'.//div/ul[@id="{dropdown_option_id}"]/li[./div[normalize-space(text())="{value}"]]'
|
|
51
100
|
try:
|
|
52
|
-
wait.until(EC.element_to_be_clickable((By.XPATH,
|
|
101
|
+
wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
53
102
|
return True
|
|
54
103
|
except NoSuchElementException:
|
|
55
104
|
return False
|
|
@@ -58,6 +107,15 @@ class DropdownUtils:
|
|
|
58
107
|
|
|
59
108
|
@staticmethod
|
|
60
109
|
def __selectDropdownValueByDropdownOptionId(wait: WebDriverWait, dropdown_option_id: str, value: str):
|
|
110
|
+
"""
|
|
111
|
+
Selects a value from a dropdown by its option id and value.
|
|
112
|
+
|
|
113
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
114
|
+
:param dropdown_option_id: The id of the dropdown options list.
|
|
115
|
+
:param value: The value to select from the dropdown.
|
|
116
|
+
Example:
|
|
117
|
+
DropdownUtils.selectDropdownValueByDropdownOptionId(wait, "dropdown_option_id", "Option Value")
|
|
118
|
+
"""
|
|
61
119
|
option_xpath = f'.//div/ul[@id="{dropdown_option_id}"]/li[./div[normalize-space(text())="{value}"]]'
|
|
62
120
|
try:
|
|
63
121
|
try:
|
|
@@ -65,7 +123,7 @@ class DropdownUtils:
|
|
|
65
123
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, option_xpath)))
|
|
66
124
|
except Exception as e:
|
|
67
125
|
raise Exception(
|
|
68
|
-
f'Could not locate or click dropdown option "{value}" with dropdown option id "{dropdown_option_id}": {str(e)}'
|
|
126
|
+
f'Could not locate or click dropdown option "{value}" with dropdown option id "{dropdown_option_id}": {str(e)}' # noqa: E501
|
|
69
127
|
)
|
|
70
128
|
except Exception as e:
|
|
71
129
|
raise Exception(f'Could not find or click dropdown option "{value}" with xpath "{option_xpath}": {str(e)}')
|
|
@@ -101,6 +159,19 @@ class DropdownUtils:
|
|
|
101
159
|
|
|
102
160
|
@staticmethod
|
|
103
161
|
def checkReadOnlyStatusByLabelText(wait: WebDriverWait, label: str):
|
|
162
|
+
"""
|
|
163
|
+
Checks if a dropdown is read-only by its label text.
|
|
164
|
+
|
|
165
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
166
|
+
:param label: The label of the dropdown.
|
|
167
|
+
:return: True if the dropdown is read-only, False otherwise.
|
|
168
|
+
Example:
|
|
169
|
+
is_read_only = DropdownUtils.checkReadOnlyStatusByLabelText(wait, "Dropdown Label")
|
|
170
|
+
if is_read_only:
|
|
171
|
+
print("The dropdown is read-only.")
|
|
172
|
+
else:
|
|
173
|
+
print("The dropdown is editable.")
|
|
174
|
+
"""
|
|
104
175
|
xpath = f'.//div[./div/span[normalize-space(text())="{label}"]]/div/div/p[text()]'
|
|
105
176
|
try:
|
|
106
177
|
wait._driver.find_element(By.XPATH, xpath)
|
|
@@ -112,20 +183,61 @@ class DropdownUtils:
|
|
|
112
183
|
|
|
113
184
|
@staticmethod
|
|
114
185
|
def selectDropdownValueByComboboxComponent(wait: WebDriverWait, combobox: WebElement, value: str):
|
|
186
|
+
"""
|
|
187
|
+
Selects a value from a dropdown using the combobox component.
|
|
188
|
+
|
|
189
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
190
|
+
:param combobox: The combobox WebElement.
|
|
191
|
+
:param value: The value to select from the dropdown.
|
|
192
|
+
Example:
|
|
193
|
+
DropdownUtils.selectDropdownValueByComboboxComponent(wait, combobox, "Option Value")
|
|
194
|
+
"""
|
|
115
195
|
dropdown_option_id = DropdownUtils.__findDropdownOptionId(wait, combobox)
|
|
116
196
|
DropdownUtils.__clickCombobox(wait, combobox)
|
|
117
197
|
DropdownUtils.__selectDropdownValueByDropdownOptionId(wait, dropdown_option_id, value)
|
|
118
198
|
|
|
119
199
|
@staticmethod
|
|
120
200
|
def selectDropdownValueByLabelText(wait: WebDriverWait, dropdown_label: str, value: str):
|
|
201
|
+
"""
|
|
202
|
+
Selects a value from a dropdown by its label text.
|
|
203
|
+
|
|
204
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
205
|
+
:param dropdown_label: The label of the dropdown.
|
|
206
|
+
:param value: The value to select from the dropdown.
|
|
207
|
+
Example:
|
|
208
|
+
DropdownUtils.selectDropdownValueByLabelText(wait, "Dropdown Label", "Option Value")
|
|
209
|
+
"""
|
|
121
210
|
DropdownUtils.__selectDropdownValueByLabelText(wait, dropdown_label, value)
|
|
122
211
|
|
|
123
212
|
@staticmethod
|
|
124
213
|
def selectDropdownValueByPartialLabelText(wait: WebDriverWait, dropdown_label: str, value: str):
|
|
214
|
+
"""
|
|
215
|
+
Selects a value from a dropdown by its partial label text.
|
|
216
|
+
|
|
217
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
218
|
+
:param dropdown_label: The partial label of the dropdown.
|
|
219
|
+
:param value: The value to select from the dropdown.
|
|
220
|
+
Example:
|
|
221
|
+
DropdownUtils.selectDropdownValueByPartialLabelText(wait, "Dropdown Label", "Option Value")
|
|
222
|
+
"""
|
|
125
223
|
DropdownUtils.__selectDropdownValueByPartialLabelText(wait, dropdown_label, value)
|
|
126
224
|
|
|
127
225
|
@staticmethod
|
|
128
226
|
def checkDropdownOptionValueExists(wait: WebDriverWait, dropdown_label: str, value: str):
|
|
227
|
+
"""
|
|
228
|
+
Checks if a dropdown option value exists by its label text.
|
|
229
|
+
|
|
230
|
+
:param wait: WebDriverWait instance to wait for elements.
|
|
231
|
+
:param dropdown_label: The label of the dropdown.
|
|
232
|
+
:param value: The value to check in the dropdown.
|
|
233
|
+
:return: True if the value exists, False otherwise.
|
|
234
|
+
Example:
|
|
235
|
+
exists = DropdownUtils.checkDropdownOptionValueExists(wait, "Dropdown Label", "Option Value")
|
|
236
|
+
if exists:
|
|
237
|
+
print("The value exists in the dropdown.")
|
|
238
|
+
else:
|
|
239
|
+
print("The value does not exist in the dropdown.")
|
|
240
|
+
"""
|
|
129
241
|
combobox = DropdownUtils.__findComboboxByLabelText(wait, dropdown_label)
|
|
130
242
|
DropdownUtils.__clickCombobox(wait, combobox)
|
|
131
243
|
dropdown_option_id = DropdownUtils.__findDropdownOptionId(wait, combobox)
|