robo_appian 0.0.3__py3-none-any.whl → 0.0.5__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/__init__.py CHANGED
@@ -1,12 +1,12 @@
1
- from robo_appian.utils.components.ButtonUtils import ButtonUtils
2
- from robo_appian.utils.components.ComponentUtils import ComponentUtils
3
- from robo_appian.utils.components.DateUtils import DateUtils
4
- from robo_appian.utils.components.DropdownUtils import DropdownUtils
5
- from robo_appian.utils.components.InputUtils import InputUtils
6
- from robo_appian.utils.components.LabelUtils import LabelUtils
7
- from robo_appian.utils.components.LinkUtils import LinkUtils
8
- from robo_appian.utils.components.TableUtils import TableUtils
9
- from robo_appian.utils.components.TabUtils import TabUtils
1
+ from robo_appian.components.ButtonUtils import ButtonUtils
2
+ from robo_appian.utils.ComponentUtils import ComponentUtils
3
+ from robo_appian.components.DateUtils import DateUtils
4
+ from robo_appian.components.DropdownUtils import DropdownUtils
5
+ from robo_appian.components.InputUtils import InputUtils
6
+ from robo_appian.components.LabelUtils import LabelUtils
7
+ from robo_appian.components.LinkUtils import LinkUtils
8
+ from robo_appian.components.TableUtils import TableUtils
9
+ from robo_appian.components.TabUtils import TabUtils
10
10
 
11
11
  __version__ = "0.0.2"
12
12
 
@@ -10,7 +10,7 @@ class ButtonUtils:
10
10
  Usage Example:
11
11
 
12
12
  from selenium.webdriver.support.ui import WebDriverWait
13
- from robo_appian.utils.components.ButtonUtils import ButtonUtils
13
+ from robo_appian.components.ButtonUtils import ButtonUtils
14
14
 
15
15
  wait = WebDriverWait(driver, 10)
16
16
  ButtonUtils.click(wait, "Login")
@@ -4,7 +4,7 @@ from selenium.webdriver.support.ui import WebDriverWait
4
4
  from selenium.webdriver.remote.webdriver import WebDriver
5
5
  from selenium.webdriver.remote.webelement import WebElement
6
6
 
7
- from robo_appian.utils.components.InputUtils import InputUtils
7
+ from robo_appian.components.InputUtils import InputUtils
8
8
 
9
9
 
10
10
  class DateUtils:
@@ -14,7 +14,7 @@ class DateUtils:
14
14
  Usage Example:
15
15
 
16
16
  # Set a date value
17
- from robo_appian.utils.components.DateUtils import DateUtils
17
+ from robo_appian.components.DateUtils import DateUtils
18
18
  DateUtils.setDateValue(wait, "Start Date", "01/01/2024")
19
19
 
20
20
  """
@@ -75,7 +75,7 @@ class DateUtils:
75
75
  # component = wait.until(EC.element_to_be_clickable((By.XPATH, f".//div/label[text()='{label}']/following-sibling::input")))
76
76
 
77
77
  component = DateUtils.findComponent(wait, label)
78
- InputUtils.setValueUsingComponent(component, value)
78
+ InputUtils._setComponentValue(component, value)
79
79
  return component
80
80
 
81
81
  @staticmethod
@@ -0,0 +1,136 @@
1
+ import stat
2
+ from turtle import st
3
+ from selenium.webdriver.common.by import By
4
+ from selenium.webdriver.support import expected_conditions as EC
5
+ from selenium.webdriver.support.ui import WebDriverWait
6
+ from selenium.webdriver.remote.webdriver import WebDriver
7
+ from selenium.webdriver.remote.webelement import WebElement
8
+
9
+ from robo_appian.components.InputUtils import InputUtils
10
+
11
+
12
+ class DropdownUtils:
13
+ """
14
+ Utility class for interacting with dropdown components in Appian UI.
15
+
16
+ Usage Example:
17
+
18
+ # Select a value from a dropdown
19
+ from robo_appian.components.DropdownUtils import DropdownUtils
20
+ DropdownUtils.selectDropdownValueByLabelText(wait, "Status", "Approved")
21
+
22
+ # Select a value from a search dropdown
23
+ from robo_appian.components.DropdownUtils import DropdownUtils
24
+ DropdownUtils.selectSearchDropdownValueByLabelText(wait, "Category", "Finance")
25
+ """
26
+
27
+ @staticmethod
28
+ def __findDropdownComponentsByXpath(wait: WebDriverWait, xpath: str):
29
+
30
+ try:
31
+ # Wait for at least one element to be present
32
+ wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
33
+
34
+ # Find all matching elements
35
+ driver = wait._driver
36
+ components = driver.find_elements(By.XPATH, xpath)
37
+
38
+ # Filter for clickable and displayed components
39
+ valid_components = []
40
+ for component in components:
41
+ try:
42
+ if component.is_displayed() and component.is_enabled():
43
+ valid_components.append(component)
44
+ except Exception:
45
+ continue
46
+
47
+ if not valid_components:
48
+ raise Exception(
49
+ f'No valid dropdown components with xpath "{xpath}" found.'
50
+ )
51
+
52
+ # Return single component if only one found, list if multiple
53
+ return valid_components
54
+
55
+ except Exception as e:
56
+ raise Exception(
57
+ f'Dropdown component with xpath "{xpath}" not found: {str(e)}'
58
+ )
59
+
60
+ @staticmethod
61
+ def selectDropdownValueByComponent(wait, combobox, value):
62
+ dropdown_id = combobox.get_attribute("aria-controls") # type: ignore[reportUnknownMemberType]
63
+ combobox.click()
64
+
65
+ option_xpath = f'.//div/ul[@id="{dropdown_id}"]/li[./div[normalize-space(text())="{value}"]]'
66
+ component = wait.until(EC.presence_of_element_located((By.XPATH, option_xpath)))
67
+ component = wait.until(EC.element_to_be_clickable((By.XPATH, option_xpath)))
68
+ component.click()
69
+
70
+ @staticmethod
71
+ def __selectDropdownValueByXpath(wait, xpath, value):
72
+ components = DropdownUtils.__findDropdownComponentsByXpath(wait, xpath)
73
+ for combobox in components:
74
+ if combobox.is_displayed() and combobox.is_enabled():
75
+ DropdownUtils.selectDropdownValueByComponent(wait, combobox, value)
76
+
77
+ @staticmethod
78
+ def selectDropdownValueByLabelText(
79
+ wait: WebDriverWait, dropdown_label: str, value: str
80
+ ):
81
+
82
+ xpath = f'.//div[./div/span[normalize-space(text())="{dropdown_label}"]]/div/div/div/div[@role="combobox" and @tabindex="0"]'
83
+ DropdownUtils.__selectDropdownValueByXpath(wait, xpath, value)
84
+
85
+ @staticmethod
86
+ def selectDropdownValueByPartialLabelText(
87
+ wait: WebDriverWait, dropdown_label: str, value: str
88
+ ):
89
+
90
+ xpath = f'.//div[./div/span[contains(normalize-space(text()), "{dropdown_label}")]]/div/div/div/div[@role="combobox" and @tabindex="0"]'
91
+ DropdownUtils.__selectDropdownValueByXpath(wait, xpath, value)
92
+
93
+ @staticmethod
94
+ def __selectSearchDropdownValueByXpath(wait, xpath, value):
95
+
96
+ components = DropdownUtils.__findDropdownComponentsByXpath(wait, xpath)
97
+
98
+ for component in components:
99
+ if component.is_displayed() and component.is_enabled():
100
+ component_id = component.get_attribute("aria-labelledby") # type: ignore[reportUnknownMemberType]
101
+ dropdown_id = component.get_attribute("aria-controls") # type: ignore[reportUnknownMemberType]
102
+ component.click()
103
+
104
+ input_component_id = str(component_id) + "_searchInput"
105
+ input_component = wait.until(
106
+ EC.element_to_be_clickable((By.ID, input_component_id))
107
+ )
108
+ InputUtils._setComponentValue(input_component, value)
109
+
110
+ xpath = f'.//ul[@id="{dropdown_id}"]/li[./div[normalize-space(text())="{value}"]][1]'
111
+ component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
112
+ component.click()
113
+
114
+ @staticmethod
115
+ def selectSearchDropdownValueByLabelText(
116
+ wait: WebDriverWait, dropdown_label: str, value: str
117
+ ):
118
+ xpath = f'.//div[./div/span[normalize-space(text())="{dropdown_label}"]]/div/div/div/div[@role="combobox" and @tabindex="0"]'
119
+ DropdownUtils.__selectSearchDropdownValueByXpath(wait, xpath, value)
120
+
121
+ @staticmethod
122
+ def selectSearchDropdownValueByPartialLabelText(
123
+ wait: WebDriverWait, dropdown_label: str, value: str
124
+ ):
125
+
126
+ xpath = f'.//div[./div/span[contains(normalize-space(text()), "{dropdown_label}")]]/div/div/div/div[@role="combobox" and @tabindex="0"]'
127
+ DropdownUtils.__selectSearchDropdownValueByXpath(wait, xpath, value)
128
+
129
+ @staticmethod
130
+ def selectValueByDropdownWrapperComponent(
131
+ wait: WebDriverWait, component: WebElement, value: str
132
+ ):
133
+ xpath = f'./div/div[@role="combobox" and @tabindex="0"]'
134
+ combobox = component.find_element(By.XPATH, xpath)
135
+ DropdownUtils.selectDropdownValueByComponent(wait, combobox, value)
136
+ return combobox
@@ -0,0 +1,107 @@
1
+ from numpy import size
2
+ from robo_appian.utils.ComponentUtils import ComponentUtils
3
+ from selenium.webdriver.common.by import By
4
+ from selenium.webdriver.common.keys import Keys
5
+ from selenium.webdriver.support import expected_conditions as EC
6
+ from selenium.webdriver.support.ui import WebDriverWait
7
+ from selenium.webdriver.remote.webelement import WebElement
8
+ from typing import List
9
+
10
+
11
+ class InputUtils:
12
+ """
13
+ Utility class for interacting with input components in Appian UI.
14
+
15
+ Usage Example:
16
+
17
+ # Set a value in an input field
18
+ from robo_appian.components.InputUtils import InputUtils
19
+ InputUtils.setValueByLabelText(wait, "Username", "test_user")
20
+
21
+ """
22
+
23
+ @staticmethod
24
+ def setValueAndSubmitUsingComponent(component: WebElement, value: str):
25
+ """
26
+ Sets a value in an input component and submits it using the provided component element.
27
+
28
+ Parameters:
29
+ component: The Selenium WebElement for the input component.
30
+ value: The value to set in the input field.
31
+
32
+ Returns:
33
+ The Selenium WebElement for the input component after setting the value and submitting.
34
+
35
+ Example:
36
+ InputUtils.setValueAndSubmitUsingComponent(component, "test_user")
37
+
38
+ """
39
+ # This method assumes that the component is already found and passed as an argument.
40
+
41
+ if not component.is_displayed():
42
+ raise Exception(
43
+ f"Component with label '{component.text}' is not displayed."
44
+ )
45
+
46
+ component = InputUtils._setComponentValue(component, value)
47
+ component.send_keys(Keys.ENTER)
48
+ return component
49
+
50
+ @staticmethod
51
+ def __findInputComponentsByLabelPath(wait: WebDriverWait, xpath: str):
52
+ label_components = ComponentUtils.findComponentsByXPath(wait, xpath)
53
+ input_components = []
54
+ for label_component in label_components:
55
+ attribute: str = "for"
56
+ component_id = label_component.get_attribute(attribute) # type: ignore[reportUnknownMemberType]
57
+ if component_id:
58
+ component = wait.until(
59
+ EC.element_to_be_clickable((By.ID, component_id))
60
+ )
61
+ input_components.append(component)
62
+ return input_components
63
+
64
+ @staticmethod
65
+ def __findInputComponentsByPartialLabel(wait: WebDriverWait, label: str):
66
+ xpath = f'.//div/label[contains(normalize-space(text()), "{label}")]'
67
+ components = InputUtils.__findInputComponentsByLabelPath(wait, xpath)
68
+ return components
69
+
70
+ @staticmethod
71
+ def __findInputComponentsByLabel(wait: WebDriverWait, label: str):
72
+ xpath = f'.//div/label[normalize-space(text())="{label}"]'
73
+ components = InputUtils.__findInputComponentsByLabelPath(wait, xpath)
74
+ return components
75
+
76
+ @staticmethod
77
+ def _setComponentValue(component: WebElement, value: str):
78
+ component.clear()
79
+ component.send_keys(value)
80
+ return component
81
+
82
+ @staticmethod
83
+ def __setValueByComponents(wait: WebDriverWait, input_components, value: str):
84
+ """
85
+ Sets a value in an input component identified by its label text.
86
+ Parameters:
87
+ wait: Selenium WebDriverWait instance.
88
+ label: The visible text label of the input component.
89
+ value: The value to set in the input field.
90
+ Returns:
91
+ None
92
+ Example:
93
+ InputUtils.setValueByLabelText(wait, "Username", "test_user")
94
+ """
95
+
96
+ for component in input_components:
97
+ InputUtils._setComponentValue(component, value)
98
+
99
+ @staticmethod
100
+ def setValueByPartialLabelText(wait: WebDriverWait, label: str, value: str):
101
+ input_components = InputUtils.__findInputComponentsByPartialLabel(wait, label)
102
+ InputUtils.__setValueByComponents(wait, input_components, value)
103
+
104
+ @staticmethod
105
+ def setValueByLabelText(wait: WebDriverWait, label: str, value: str):
106
+ input_components = InputUtils.__findInputComponentsByLabel(wait, label)
107
+ InputUtils.__setValueByComponents(wait, input_components, value)
@@ -11,7 +11,7 @@ class LabelUtils:
11
11
  Usage Example:
12
12
 
13
13
  # Find a label component
14
- from robo_appian.utils.components.LabelUtils import LabelUtils
14
+ from robo_appian.components.LabelUtils import LabelUtils
15
15
  label_component = LabelUtils.find(wait, "Username")
16
16
 
17
17
  """
@@ -12,7 +12,7 @@ class LinkUtils:
12
12
  Usage Example:
13
13
 
14
14
  # Click a link with a specific label
15
- from robo_appian.utils.components.LinkUtils import LinkUtils
15
+ from robo_appian.components.LinkUtils import LinkUtils
16
16
  LinkUtils.click(wait, "Learn More")
17
17
 
18
18
  """
@@ -0,0 +1,64 @@
1
+ from selenium.webdriver.support.ui import WebDriverWait
2
+ from selenium.webdriver.common.by import By
3
+ from selenium.webdriver.support import expected_conditions as EC
4
+ from robo_appian.components.InputUtils import InputUtils
5
+ from robo_appian.utils.ComponentUtils import ComponentUtils
6
+
7
+
8
+ class SearchInputUtils:
9
+
10
+ @staticmethod
11
+ def __findSearchInputComponentsByLabelPathAndSelectValue(
12
+ wait: WebDriverWait, xpath: str, value: str
13
+ ):
14
+ search_input_components = ComponentUtils.findComponentsByXPath(wait, xpath)
15
+ input_components = []
16
+ for search_input_component in search_input_components:
17
+ attribute: str = "aria-controls"
18
+ dropdown_list_id = search_input_component.get_attribute(attribute)
19
+ if dropdown_list_id:
20
+ InputUtils._setComponentValue(search_input_component, value)
21
+ xpath = f".//ul[@id='{dropdown_list_id}' and @role='listbox' ]/li[@role='option']/div/div/div/div/div/div/p[text()='{value}'][1]"
22
+ drop_down_item = wait.until(
23
+ EC.element_to_be_clickable((By.XPATH, xpath))
24
+ )
25
+ drop_down_item.click()
26
+ else:
27
+ raise ValueError(
28
+ f"Search input component with label '{search_input_component.text}' does not have 'aria-controls' attribute."
29
+ )
30
+
31
+ return input_components
32
+
33
+ @staticmethod
34
+ def __selectSearchInputComponentsByPartialLabelText(
35
+ wait: WebDriverWait, label: str, value: str
36
+ ):
37
+ xpath = f".//div[./div/span[contains(normalize-space(text())='{label}']]/div/div/div/input[@role='combobox']"
38
+ SearchInputUtils.__findSearchInputComponentsByLabelPathAndSelectValue(
39
+ wait, xpath, value
40
+ )
41
+
42
+ @staticmethod
43
+ def __selectSearchInputComponentsByLabelText(
44
+ wait: WebDriverWait, label: str, value: str
45
+ ):
46
+ xpath = (
47
+ f".//div[./div/span[text()='{label}']]/div/div/div/input[@role='combobox']"
48
+ )
49
+ SearchInputUtils.__findSearchInputComponentsByLabelPathAndSelectValue(
50
+ wait, xpath, value
51
+ )
52
+
53
+ @staticmethod
54
+ def selectSearchDropdownByLabelText(wait: WebDriverWait, label: str, value: str):
55
+
56
+ SearchInputUtils.__selectSearchInputComponentsByLabelText(wait, label, value)
57
+
58
+ @staticmethod
59
+ def selectSearchDropdownByPartialLabelText(
60
+ wait: WebDriverWait, label: str, value: str
61
+ ):
62
+ SearchInputUtils.__selectSearchInputComponentsByPartialLabelText(
63
+ wait, label, value
64
+ )
@@ -9,11 +9,11 @@ class TabUtils:
9
9
  Usage Example:
10
10
 
11
11
  # Select a tab by its label
12
- from robo_appian.utils.components.TabUtils import TabUtils
12
+ from robo_appian.components.TabUtils import TabUtils
13
13
  TabUtils.select_tab(wait, "Settings")
14
14
 
15
15
  # Find the currently selected tab by its label
16
- from robo_appian.utils.components.TabUtils import TabUtils
16
+ from robo_appian.components.TabUtils import TabUtils
17
17
  selected_tab = TabUtils.find_selected_tab(wait, "Settings")
18
18
  """
19
19
 
@@ -11,7 +11,7 @@ class TableUtils:
11
11
  Usage Example:
12
12
 
13
13
  # Find a table using a column name
14
- from robo_appian.utils.components.TableUtils import TableUtils
14
+ from robo_appian.components.TableUtils import TableUtils
15
15
  table = TableUtils.findTableUsingColumnName(wait, "Status")
16
16
 
17
17
  """
@@ -140,6 +140,10 @@ class TableUtils:
140
140
 
141
141
  xpath = f'./thead/tr/th[@scope="col" and @abbr="{columnName}"]'
142
142
  component = tableObject.find_element(By.XPATH, xpath)
143
+
144
+ if component is None:
145
+ raise ValueError(f"Could not find a column with abbr '{columnName}' in the table header.")
146
+
143
147
  class_string = component.get_attribute("class")
144
148
  partial_string = "headCell_"
145
149
  words = class_string.split()
@@ -149,6 +153,9 @@ class TableUtils:
149
153
  if partial_string in word:
150
154
  selected_word = word
151
155
 
156
+ if selected_word is None:
157
+ raise ValueError(f"Could not find a class containing '{partial_string}' in the column header for '{columnName}'.")
158
+
152
159
  data = selected_word.split("_")
153
160
  return int(data[1])
154
161
 
@@ -1,10 +1,13 @@
1
- from robo_appian.utils.components.ComponentUtils import ComponentUtils
2
- from robo_appian.utils.components.DateUtils import DateUtils
3
- from robo_appian.utils.components.DropdownUtils import DropdownUtils
4
- from robo_appian.utils.components.InputUtils import InputUtils
5
- from robo_appian.utils.components.LabelUtils import LabelUtils
6
- from robo_appian.utils.components.LinkUtils import LinkUtils
7
- from robo_appian.utils.components.TabUtils import TabUtils
1
+ from robo_appian.components.ButtonUtils import ButtonUtils
2
+ from selenium.webdriver.support.ui import WebDriverWait
3
+ from robo_appian.utils.ComponentUtils import ComponentUtils
4
+ from robo_appian.components.DateUtils import DateUtils
5
+ from robo_appian.components.DropdownUtils import DropdownUtils
6
+ from robo_appian.components.InputUtils import InputUtils
7
+ from robo_appian.components.LabelUtils import LabelUtils
8
+ from robo_appian.components.LinkUtils import LinkUtils
9
+ from robo_appian.components.TabUtils import TabUtils
10
+ from robo_appian.components.SearchInputUtils import SearchInputUtils
8
11
 
9
12
 
10
13
  class ComponentDriver:
@@ -17,7 +20,7 @@ class ComponentDriver:
17
20
  """
18
21
 
19
22
  @staticmethod
20
- def execute(wait : WebDriverWait, type, action, label, value):
23
+ def execute(wait: WebDriverWait, type, action, label, value):
21
24
  """
22
25
  Executes an action on a specified component type.
23
26
  Parameters:
@@ -42,13 +45,15 @@ class ComponentDriver:
42
45
  case "Input Text":
43
46
  match action:
44
47
  case "Set Value":
45
- InputUtils.setInputValue(wait, label, value)
48
+ InputUtils.setValueByLabelText(wait, label, value)
46
49
  case _:
47
50
  raise ValueError(f"Unsupported action for {type}: {action}")
48
51
  case "Search Input Text":
49
52
  match action:
50
53
  case "Select":
51
- InputUtils.setSearchInputValue(wait, label, value)
54
+ SearchInputUtils.selectSearchDropdownByLabelText(
55
+ wait, label, value
56
+ )
52
57
  case _:
53
58
  raise ValueError(f"Unsupported action for {type}: {action}")
54
59
  case "Label":
@@ -66,19 +71,19 @@ class ComponentDriver:
66
71
  case "Drop Down":
67
72
  match action:
68
73
  case "Select":
69
- DropdownUtils.selectDropdownValue(wait, label, value)
74
+ DropdownUtils.selectDropdownValueByLabelText(wait, label, value)
70
75
  case _:
71
76
  raise ValueError(f"Unsupported action for {type}: {action}")
72
77
  case "Search Drop Down":
73
78
  match action:
74
79
  case "Select":
75
- DropdownUtils.selectSearchDropdownValue(wait, label, value)
80
+ DropdownUtils.selectSearchDropdownValueByLabelText(wait, label, value)
76
81
  case _:
77
82
  raise ValueError(f"Unsupported action for {type}: {action}")
78
83
  case "Button":
79
84
  match action:
80
85
  case "Click":
81
- ComponentUtils.click_button(wait, label)
86
+ ButtonUtils.click(wait, label)
82
87
  case _:
83
88
  raise ValueError(f"Unsupported action for {type}: {action}")
84
89
  case "Tab":
@@ -37,97 +37,6 @@ class ComponentUtils:
37
37
  yesterday_formatted = yesterday.strftime("%m/%d/%Y")
38
38
  return yesterday_formatted
39
39
 
40
- # @staticmethod
41
- # def find_dropdown_id(wait, dropdown_label):
42
- # label_class_name = "FieldLayout---field_label"
43
- # xpath = f'.//div/span[normalize-space(text())="{dropdown_label}" and @class="{label_class_name}"]'
44
- # span_element = wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
45
- # span_element_id = span_element.get_attribute('id')
46
- # return span_element_id
47
-
48
- # @staticmethod
49
- # def find_input_id(wait, label_text):
50
- # label_class_name = "FieldLayout---field_label"
51
- # xpath = f'.//div/div/label[@class="{label_class_name}" and contains(normalize-space(text()), "{label_text}")]'
52
- # label_element = wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
53
- # input_element_id = label_element.get_attribute('for')
54
- # return input_element_id
55
-
56
- # @staticmethod
57
- # def set_input_value(wait, label_text, value):
58
- # input_element_id = ComponentUtils.find_input_id(wait, label_text)
59
- # input_element = ComponentUtils.set_input_value_using_id(wait, input_element_id, value)
60
- # return input_element
61
-
62
- # @staticmethod
63
- # def set_input_value_using_id(wait, input_element_id, value):
64
- # input_element = wait.until(EC.presence_of_element_located((By.ID, input_element_id)))
65
- # input_element = wait.until(EC.element_to_be_clickable((By.ID, input_element_id)))
66
- # input_element.clear()
67
- # input_element.send_keys(value)
68
- # input_element.send_keys(Keys.RETURN)
69
- # return input_element
70
-
71
- # @staticmethod
72
- # def select_search_dropdown_value(wait, label, value):
73
- # span_element_id = ComponentUtils.find_dropdown_id(wait, label)
74
- # xpath = f'.//div[@id="{span_element_id}_value"]'
75
- # combobox = wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
76
- # disabled = combobox.get_attribute("aria-disabled")
77
- # if disabled == "true":
78
- # return
79
- # aria_controls = combobox.get_attribute("aria-controls")
80
- # combobox = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
81
- # combobox.click()
82
-
83
- # input_element_id = span_element_id + "_searchInput"
84
- # ComponentUtils.set_input_value_using_id(wait, input_element_id, value)
85
-
86
- # xpath = f'.//ul[@id="{aria_controls}"]/li[./div[normalize-space(text())="{value}"]]'
87
- # component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
88
- # component.click()
89
-
90
- # @staticmethod
91
- # def selectDropdownValue(wait, combobox, value):
92
-
93
- # aria_controls = combobox.get_attribute("aria-controls")
94
- # combobox.click()
95
-
96
- # xpath = f'.//div/ul[@id="{aria_controls}"]/li[./div[normalize-space(text())="{value}"]]'
97
- # component = wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
98
- # component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
99
- # component.click()
100
-
101
- # @staticmethod
102
- # def select_dropdown_value(wait, label, value):
103
- # span_element_id = ComponentUtils.find_dropdown_id(wait, label)
104
-
105
- # xpath = f'.//div[@id="{span_element_id}_value"]'
106
- # combobox = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
107
- # disabled = combobox.get_attribute("aria-disabled")
108
- # if disabled == "true":
109
- # return
110
-
111
- # combobox = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
112
- # ComponentUtils.selectDropdownValue(wait, combobox, value)
113
-
114
- # @staticmethod
115
- # def findButton(wait, button_text):
116
- # xpath = f'.//button[.//span/span[contains(normalize-space(text()), "{button_text}")]]'
117
- # component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
118
- # return component
119
-
120
- # @staticmethod
121
- # def click_button(wait, button_text):
122
- # component = ComponentUtils.findButton(wait, button_text)
123
- # component.click()
124
-
125
- # @staticmethod
126
- # def select_tab(wait, tab_label_text):
127
- # xpath = f'.//div[@role="presentation"]/div/div/p[./span[normalize-space(text())="{tab_label_text}"]]'
128
- # component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
129
- # component.click()
130
-
131
40
  @staticmethod
132
41
  def findSuccessMessage(wait: WebDriverWait, message: str):
133
42
  """
@@ -261,15 +170,6 @@ class ComponentUtils:
261
170
 
262
171
  return length
263
172
 
264
- # @staticmethod
265
- # def findComponent(wait, label):
266
- # xpath = f".//div/label[text()='{label}']"
267
- # component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
268
- # component_id = component.get_attribute("for")
269
-
270
- # component = wait.until(EC.element_to_be_clickable((By.ID, component_id)))
271
- # return component
272
-
273
173
  @staticmethod
274
174
  def tab(driver: WebDriver):
275
175
  """
@@ -287,3 +187,40 @@ class ComponentUtils:
287
187
 
288
188
  actions = ActionChains(driver)
289
189
  actions.send_keys(Keys.TAB).perform()
190
+
191
+ @staticmethod
192
+ def findComponentsByXPath(wait: WebDriverWait, xpath: str):
193
+ """
194
+ Finds multiple components that match the same XPath.
195
+
196
+ Parameters:
197
+ wait: Selenium WebDriverWait instance.
198
+ xpath: The XPath expression to find components.
199
+
200
+ Returns:
201
+ List of WebElement objects that match the XPath.
202
+
203
+ Raises:
204
+ Exception: If no components are found.
205
+ """
206
+
207
+ # Wait for at least one element to be present
208
+ wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
209
+
210
+ # Find all matching elements
211
+ driver = wait._driver
212
+ components = driver.find_elements(By.XPATH, xpath)
213
+
214
+ # Filter for clickable and displayed components
215
+ valid_components = []
216
+ for component in components:
217
+ try:
218
+ if component.is_displayed() and component.is_enabled():
219
+ valid_components.append(component)
220
+ except Exception:
221
+ continue
222
+
223
+ if len(valid_components) > 0:
224
+ return valid_components
225
+
226
+ raise Exception(f"No valid components found for XPath: {xpath}")
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.3
2
+ Name: robo_appian
3
+ Version: 0.0.5
4
+ Summary: Automate your Appian code testing with Python. Boost quality, save time.
5
+ Author: Dinil Mithra
6
+ Author-email: dinilmithra@mailme@gmail.com
7
+ Requires-Python: >=3.12,<4.0
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Dist: numpy
13
+ Requires-Dist: requests (>=2.25.1,<3.0.0)
14
+ Requires-Dist: selenium (>=4.34.0)
15
+ Project-URL: Homepage, https://github.com/dinilmithra/robo_appian
16
+ Project-URL: Repository, https://github.com/dinilmithra/robo_appian.git
17
+ Description-Content-Type: text/markdown
18
+
19
+ # Robo Appian
20
+
21
+ **Automate your Appian code testing with Python. Boost quality, save time.**
22
+
23
+ [![PyPI version](https://badge.fury.io/py/robo-appian.svg)](https://badge.fury.io/py/robo-appian)
24
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
25
+ [![Documentation](https://img.shields.io/badge/docs-mkdocs-blue.svg)](https://dinilmithra.github.io/robo_appian/)
26
+
27
+ ## 🚀 Quick Start
28
+
29
+ ### Installation
30
+
31
+ ```bash
32
+ pip install robo-appian
33
+ ```
34
+
35
+ ### Basic Usage
36
+
37
+ ```python
38
+ from selenium import webdriver
39
+ from selenium.webdriver.support.ui import WebDriverWait
40
+ from robo_appian import ButtonUtils, InputUtils, TableUtils
41
+
42
+ # Setup your driver
43
+ driver = webdriver.Chrome()
44
+ wait = WebDriverWait(driver, 10)
45
+
46
+ # Interact with Appian components
47
+ ButtonUtils.click(wait, "Submit")
48
+ InputUtils.set_text(wait, "Username", "john.doe")
49
+ TableUtils.click_cell_link(wait, "Actions", 1, "Edit")
50
+ ```
51
+
52
+ ## 📚 Features
53
+
54
+ ### Components
55
+ - **ButtonUtils**: Find and click buttons
56
+ - **DateUtils**: Interact with date fields and date pickers
57
+ - **DropdownUtils**: Interact with dropdown/select components
58
+ - **InputUtils**: Interact with input fields and text areas
59
+ - **LabelUtils**: Find and interact with labels
60
+ - **LinkUtils**: Click links and navigate
61
+ - **TableUtils**: Interact with tables and grids
62
+ - **TabUtils**: Switch between tabs
63
+ - **ComponentUtils**: General component utilities
64
+
65
+ ### Controllers
66
+ - **ComponentDriver**: High-level interface for component interaction
67
+
68
+ ### Exceptions
69
+ - **MyCustomError**: Custom exceptions for better error handling
70
+
71
+ ## 📖 Documentation
72
+
73
+ Visit our [full documentation](https://dinilmithra.github.io/robo_appian/) for:
74
+ - Detailed API reference
75
+ - Complete examples and tutorials
76
+ - Installation guide
77
+ - Best practices
78
+
79
+ ## 🛠️ Requirements
80
+
81
+ - Python 3.12+
82
+ - Selenium WebDriver 4.34.0+
83
+ - Compatible web browser (Chrome, Firefox, etc.)
84
+
85
+ ## 🤝 Contributing
86
+
87
+ Contributions are welcome! Please feel free to submit a Pull Request.
88
+
89
+ ## 📄 License
90
+
91
+ This project is licensed under the MIT License.
92
+
93
+ ## 🔗 Links
94
+
95
+ - [Documentation](https://dinilmithra.github.io/robo_appian/)
96
+ - [PyPI Package](https://pypi.org/project/robo-appian/)
97
+ - [GitHub Repository](https://github.com/dinilmithra/robo_appian)
98
+ ButtonUtils, ComponentUtils, DateUtils, DropdownUtils, InputUtils,
99
+ LabelUtils, LinkUtils, TableUtils, TabUtils
100
+ )
101
+
102
+ # Example: Set a Date Value
103
+ DateUtils.set_date_value("date_field_id", "2023-10-01")
104
+
105
+ # Example: Click a Button
106
+ ButtonUtils.click_button("submit_button_id")
107
+
108
+ # Example: Select a Dropdown Value
109
+ DropdownUtils.select_value("dropdown_id", "Option 1")
110
+
111
+ # Example: Enter Text in an Input Field
112
+ InputUtils.enter_text("input_field_id", "Sample Text")
113
+
114
+ # Example: Click a Link
115
+ LinkUtils.click_link("link_id")
116
+
117
+ # Example: Click a Tab
118
+ TabUtils.click_tab("tab_id")
119
+
120
+ # Example: Get a Table Cell Value
121
+ TableUtils.get_cell_value("table_id", 1, 2) # Row 1, Column 2
122
+
123
+ # Example: Get a Label Value
124
+ LabelUtils.get_label_value("label_id")
125
+
126
+ # Example: Get a Component Value
127
+ ComponentUtils.get_component_value("component_id")
128
+
129
+ # Example: Use the Component Driver
130
+ from robo_appian.utils.controllers.ComponentDriver import ComponentDriver
131
+ ComponentDriver.execute(wait, "Button", "Click", "Submit", None)
132
+
133
+ ## Dependencies
134
+
135
+ Python >= 3.8
136
+ Uses selenium
137
+
138
+ ## License
139
+
140
+ MIT License. See LICENSE.
@@ -0,0 +1,21 @@
1
+ robo_appian/__init__.py,sha256=6u9n2W7P1IKSSr5IPGsg7LhVR1o1uYv424mXDjJLgb0,720
2
+ robo_appian/components/ButtonUtils.py,sha256=1bBWsnr51idniVs2rHqOpPNPR6g-AGYjCwx2YWyYy4o,2198
3
+ robo_appian/components/DateUtils.py,sha256=mmvyYVgp0thiIQ2uaUiEV-aXwsyCp2d1W8hKR6j_E4M,4599
4
+ robo_appian/components/DropdownUtils.py,sha256=5p6Twef2dYf8Zta_SP3sIcWbaZqVI-yeMNOywHHitHw,5720
5
+ robo_appian/components/InputUtils.py,sha256=BFvNwFoNy3enAspKr0uTxfJrdVye3FuGiZz3QuNf-e8,4125
6
+ robo_appian/components/LabelUtils.py,sha256=qajWEHEpFcBf5sSrkLA6Q0qX_FiHcZjOZeY_P8qXt1o,1224
7
+ robo_appian/components/LinkUtils.py,sha256=0wE2Pr-6X5g3oLrKNSSo0Zo-fcZo5WQXdQTw4Z2dvI8,1414
8
+ robo_appian/components/SearchInputUtils.py,sha256=WbPrsDVWnagtz1Vkj0gftf6jfTYivODEeqz2E12oXUc,2576
9
+ robo_appian/components/TabUtils.py,sha256=A3Zeu5Lg7JcD_c_xCtIm7Xkjm53VTLtBhzFGLyY0FoA,2058
10
+ robo_appian/components/TableUtils.py,sha256=CeYYmFdOD0F78UkkVXlRmrZatPr94oSVCHyGf_fgfuw,8583
11
+ robo_appian/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ robo_appian/controllers/ComponentDriver.py,sha256=faeC_T06aT9XbDnUPqGwpG5ng7wULPmZigyU8TXLCu4,4354
13
+ robo_appian/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ robo_appian/exceptions/MyCustomError.py,sha256=DVAkytXNNQNjqyTyCjk6FFd6fr3AsBe57Y19erDSqVs,222
15
+ robo_appian/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ robo_appian/utils/ComponentUtils.py,sha256=uq1y6_DxH3O-m7vCvtdVE5640Wx8Je8ydA7pbKDrKVw,8398
17
+ robo_appian/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ robo_appian-0.0.5.dist-info/LICENSE,sha256=g-xR4dRa9_4iFkMoJmED-wE-J5hoxbk3105Knhfpjm0,1068
19
+ robo_appian-0.0.5.dist-info/METADATA,sha256=xbaYUrn9O378n6Hr2u_LjslomPmdu1tDk322mRo-mJk,4104
20
+ robo_appian-0.0.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
21
+ robo_appian-0.0.5.dist-info/RECORD,,
@@ -1,141 +0,0 @@
1
- from selenium.webdriver.common.by import By
2
- from selenium.webdriver.support import expected_conditions as EC
3
- from selenium.webdriver.support.ui import WebDriverWait
4
- from selenium.webdriver.remote.webdriver import WebDriver
5
- from selenium.webdriver.remote.webelement import WebElement
6
-
7
- from robo_appian.utils.components.InputUtils import InputUtils
8
-
9
-
10
- class DropdownUtils:
11
- """
12
- Utility class for interacting with dropdown components in Appian UI.
13
-
14
- Usage Example:
15
-
16
- # Select a value from a dropdown
17
- from robo_appian.utils.components.DropdownUtils import DropdownUtils
18
- DropdownUtils.selectDropdownValue(wait, "Status", "Approved")
19
-
20
- # Select a value from a search dropdown
21
- from robo_appian.utils.components.DropdownUtils import DropdownUtils
22
- DropdownUtils.selectSearchDropdownValue(wait, "Category", "Finance")
23
- """
24
-
25
- @staticmethod
26
- def findDropdownEnabled(wait: WebDriverWait, dropdown_label: str):
27
- """
28
- Finds a dropdown component that is enabled and has the specified label.
29
-
30
- Parameters:
31
- wait: Selenium WebDriverWait instance.
32
- dropdown_label: The visible text label of the dropdown component.
33
-
34
- Returns:
35
- The Selenium WebElement for the dropdown component.
36
-
37
- Example:
38
- DropdownUtils.findDropdownEnabled(wait, "Status")
39
-
40
- """
41
- # This method locates a dropdown component that contains a label with the specified text.
42
- # It then retrieves the component's ID and uses it to find the actual dropdown element.
43
- # The dropdown is identified by its role as a combobox and tabindex attribute.
44
- # The XPath searches for a div that contains a span with the specified label text.
45
- # It ensures that the dropdown is clickable and ready for interaction.
46
- # The dropdown component is expected to have a structure where the label is within a span inside a div.
47
-
48
- xpath = f'.//div[./div/span[normalize-space(text())="{dropdown_label}"]]/div/div/div/div[@role="combobox" and @tabindex="0"]'
49
- component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
50
- return component
51
-
52
- @staticmethod
53
- def selectValueUsingComponent(
54
- wait: WebDriverWait,
55
- combobox: WebElement,
56
- value: str
57
- ) -> None:
58
- """
59
- Selects a value from a dropdown component using the provided combobox element.
60
-
61
- Parameters:
62
- wait: Selenium WebDriverWait instance.
63
- combobox: The Selenium WebElement for the combobox.
64
- value: The value to select from the dropdown.
65
-
66
- Example:
67
- DropdownUtils.selectValueUsingComponent(wait, combobox, "Approved")
68
-
69
- """
70
- # This method assumes that the combobox is already found and passed as an argument.
71
- # It retrieves the aria-controls attribute to find the dropdown list and selects the specified value.
72
-
73
- if not combobox:
74
- raise ValueError(f"Dropdown component object is not valid.")
75
-
76
- component: WebElement = combobox.find_element(By.XPATH, "./div/div") # type: ignore[reportUnknownMemberType]
77
- aria_controls = component.get_attribute("aria-controls") # type: ignore[reportUnknownMemberType]
78
- component.click()
79
-
80
- xpath = f'.//div/ul[@id="{aria_controls}"]/li[./div[normalize-space(text())="{value}"]]'
81
- # component = wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
82
- component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
83
- component.click()
84
-
85
- @staticmethod
86
- def selectDropdownValue(wait: WebDriverWait, label: str, value: str) -> None:
87
- """
88
- Selects a value from a dropdown component identified by its label.
89
-
90
- Parameters:
91
- wait: Selenium WebDriverWait instance.
92
- label: The visible text label of the dropdown component.
93
- value: The value to select from the dropdown.
94
-
95
- Example:
96
- DropdownUtils.selectDropdownValue(wait, "Status", "Approved")
97
-
98
- """
99
- # This method finds the dropdown component by its label, retrieves the aria-controls attribute,
100
- # and then clicks on the dropdown to display the options.
101
-
102
- combobox = DropdownUtils.findDropdownEnabled(wait, label)
103
- aria_controls = combobox.get_attribute("aria-controls") # type: ignore[reportUnknownMemberType]
104
- combobox.click()
105
-
106
- xpath = f'.//div/ul[@id="{aria_controls}"]/li[./div[normalize-space(text())="{value}"]]'
107
- component = wait.until(EC.presence_of_element_located((By.XPATH, xpath)))
108
- component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
109
- component.click()
110
-
111
- @staticmethod
112
- def selectSearchDropdownValue(wait: WebDriverWait, dropdown_label: str, value: str):
113
- """
114
- Selects a value from a search-enabled dropdown component identified by its label.
115
-
116
- Parameters:
117
- wait: Selenium WebDriverWait instance.
118
- dropdown_label: The visible text label of the search dropdown component.
119
- value: The value to select from the dropdown.
120
-
121
- Example:
122
- DropdownUtils.selectSearchDropdownValue(wait, "Category", "Finance")
123
-
124
- """
125
- # This method finds the search-enabled dropdown component by its label, retrieves the aria-controls attribute
126
- # and the component ID, clicks on the dropdown to display the search input,
127
-
128
- component = DropdownUtils.findDropdownEnabled(wait, dropdown_label)
129
- component_id = component.get_attribute("aria-labelledby") # type: ignore[reportUnknownMemberType]
130
- aria_controls = component.get_attribute("aria-controls") # type: ignore[reportUnknownMemberType]
131
- component.click()
132
-
133
- input_component_id = str(component_id) + "_searchInput"
134
- input_component = wait.until(
135
- EC.element_to_be_clickable((By.ID, input_component_id))
136
- )
137
- InputUtils.setValueUsingComponent(input_component, value)
138
-
139
- xpath = f'.//ul[@id="{aria_controls}"]/li[./div[normalize-space(text())="{value}"]][1]'
140
- component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
141
- component.click()
@@ -1,189 +0,0 @@
1
- from selenium.webdriver.common.by import By
2
- from selenium.webdriver.common.keys import Keys
3
- from selenium.webdriver.support import expected_conditions as EC
4
- from selenium.webdriver.support.ui import WebDriverWait
5
- from selenium.webdriver.remote.webdriver import WebDriver
6
- from selenium.webdriver.remote.webelement import WebElement
7
-
8
-
9
- class InputUtils:
10
- """
11
- Utility class for interacting with input components in Appian UI.
12
-
13
- Usage Example:
14
-
15
- # Set a value in an input field
16
- from robo_appian.utils.components.InputUtils import InputUtils
17
- InputUtils.setInputValue(wait, "Username", "test_user")
18
-
19
- """
20
-
21
- @staticmethod
22
- def findComponent(wait: WebDriverWait, label: str):
23
- """
24
- Finds an input component by its label.
25
-
26
- Parameters:
27
- wait: Selenium WebDriverWait instance.
28
- label: The visible text label of the input component.
29
-
30
- Returns:
31
- The Selenium WebElement for the input component.
32
-
33
- Example:
34
- InputUtils.findComponent(wait, "Username")
35
-
36
- """
37
- # This method locates an input component that contains a label with the specified text.
38
- # It then retrieves the component's ID and uses it to find the actual input element.
39
-
40
- xpath = f".//div/label[text()='{label}']"
41
- component: WebElement = wait.until(
42
- EC.element_to_be_clickable((By.XPATH, xpath))
43
- )
44
-
45
- attribute: str = "for"
46
- component_id = component.get_attribute(attribute) # type: ignore[reportUnknownMemberType]
47
- if not component_id:
48
- raise ValueError(
49
- f"Could not find component using {attribute} attribute for label '{label}'."
50
- )
51
-
52
- component = wait.until(EC.element_to_be_clickable((By.ID, component_id)))
53
- return component
54
-
55
- @staticmethod
56
- def setValueUsingComponent(component: WebElement, value: str):
57
- """
58
- Sets a value in an input component using the provided component element.
59
-
60
- Parameters:
61
- component: The Selenium WebElement for the input component.
62
- value: The value to set in the input field.
63
-
64
- Returns:
65
- The Selenium WebElement for the input component after setting the value.
66
-
67
- Example:
68
- InputUtils.setValueUsingComponent(component, "test_user")
69
-
70
- """
71
- # This method assumes that the component is already found and passed as an argument.
72
- # It clears the existing value and sets the new value in the input field.
73
-
74
- if not component.is_displayed():
75
- raise Exception(
76
- f"Component with label '{component.text}' is not displayed."
77
- )
78
-
79
- component.clear()
80
- component.send_keys(value)
81
- return component
82
-
83
- @staticmethod
84
- def setValueAndSubmitUsingComponent(component: WebElement, value: str):
85
- """
86
- Sets a value in an input component and submits it using the provided component element.
87
-
88
- Parameters:
89
- component: The Selenium WebElement for the input component.
90
- value: The value to set in the input field.
91
-
92
- Returns:
93
- The Selenium WebElement for the input component after setting the value and submitting.
94
-
95
- Example:
96
- InputUtils.setValueAndSubmitUsingComponent(component, "test_user")
97
-
98
- """
99
- # This method assumes that the component is already found and passed as an argument.
100
-
101
- if not component.is_displayed():
102
- raise Exception(
103
- f"Component with label '{component.text}' is not displayed."
104
- )
105
-
106
- component = InputUtils.setValueUsingComponent(component, value)
107
- component.send_keys(Keys.ENTER)
108
- return component
109
-
110
- @staticmethod
111
- def setInputValue(wait: WebDriverWait, label: str, value: str):
112
- """
113
- Sets a value in an input component identified by its label.
114
-
115
- Parameters:
116
- wait: Selenium WebDriverWait instance.
117
- label: The visible text label of the input component.
118
- value: The value to set in the input field.
119
-
120
- Returns:
121
- The Selenium WebElement for the input component after setting the value.
122
-
123
- Example:
124
- InputUtils.setInputValue(wait, "Username", "test_user")
125
-
126
- """
127
- # This method finds the input component by its label and sets the specified value in it.
128
- # It retrieves the component's ID and uses it to find the actual input element.
129
-
130
- component = InputUtils.findComponent(wait, label)
131
- InputUtils.setValueUsingComponent(component, value)
132
- return component
133
-
134
- @staticmethod
135
- def setValueAndSubmit(wait: WebDriverWait, label: str, value: str):
136
- """
137
- Sets a value in an input component identified by its label and submits it.
138
-
139
- Parameters:
140
- wait: Selenium WebDriverWait instance.
141
- label: The visible text label of the input component.
142
- value: The value to set in the input field.
143
-
144
- Returns:
145
- The Selenium WebElement for the input component after setting the value and submitting.
146
-
147
- Example:
148
- InputUtils.setValueAndSubmit(wait, "Username", "test_user")
149
-
150
- """
151
- # This method finds the input component by its label, sets the specified value in it,
152
- # and submits the form by sending an ENTER key.
153
-
154
- component = InputUtils.findComponent(wait, label)
155
- component = InputUtils.setValueAndSubmitUsingComponent(component, value)
156
- return component
157
-
158
- @staticmethod
159
- def setSearchInputValue(wait: WebDriverWait, label: str, value: str):
160
- """
161
- Sets a value in a search-enabled input component identified by its label.
162
-
163
- Parameters:
164
- wait: Selenium WebDriverWait instance.
165
- label: The visible text label of the search input component.
166
- value: The value to set in the search input field.
167
-
168
- Returns:
169
- None
170
- Example:
171
- InputUtils.setSearchInputValue(wait, "Search", "Appian")
172
-
173
- """
174
- # This method finds the search-enabled input component by its label, retrieves the aria-controls attribute
175
- # and the component ID, clicks on the input to display the search input,
176
- # and sets the specified value in the search input field.
177
-
178
- xpath = (
179
- f".//div[./div/span[text()='{label}']]/div/div/div/input[@role='combobox']"
180
- )
181
- search_input_component = wait.until(
182
- EC.element_to_be_clickable((By.XPATH, xpath))
183
- )
184
- aria_controls = search_input_component.get_attribute("aria-controls") # type: ignore[reportUnknownMemberType]
185
- InputUtils.setValueUsingComponent(search_input_component, value)
186
-
187
- xpath = f".//ul[@id='{aria_controls}' and @role='listbox' ]/li[@role='option']/div/div/div/div/div/div/p[text()='{value}'][1]"
188
- drop_down_item = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
189
- drop_down_item.click()
@@ -1,91 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: robo_appian
3
- Version: 0.0.3
4
- Summary: Automate your Appian code testing with Python. Boost quality, save time.
5
- Author: Dinil Mithra
6
- Author-email: dinilmithra@mailme@gmail.com
7
- Requires-Python: >=3.12,<4.0
8
- Classifier: Operating System :: OS Independent
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.12
11
- Classifier: Programming Language :: Python :: 3.13
12
- Requires-Dist: numpy
13
- Requires-Dist: requests (>=2.25.1,<3.0.0)
14
- Requires-Dist: selenium (>=4.34.0)
15
- Project-URL: Homepage, https://github.com/dinilmithra/robo_appian
16
- Project-URL: Repository, https://github.com/dinilmithra/robo_appian.git
17
- Description-Content-Type: text/markdown
18
-
19
- # Robo Appian
20
-
21
- Python library for automating Appian web UI test cases!
22
-
23
- # Modules
24
- ## Components
25
-
26
- ButtonUtils: Find and click buttons.
27
- DateUtils: Interact with date fields.
28
- DropdownUtils: Interact with dropdowns.
29
- InputUtils: Interact with input fields.
30
- LabelUtils: Find labels.
31
- LinkUtils: Click links.
32
- TableUtils: Interact with tables.
33
- TabUtils: Interact with tabs.
34
- ComponentUtils: General utilities for components (input, dropdown, tab, etc).
35
-
36
- ## Controllers
37
-
38
- ComponentDriver: High-level interface to execute actions on components.
39
-
40
- ## Exceptions
41
-
42
- MyCustomError: Custom exception for specific error conditions.
43
-
44
- # Usage
45
-
46
- Import the utilities in your test scripts:
47
-
48
- from robo_appian import (
49
- ButtonUtils, ComponentUtils, DateUtils, DropdownUtils, InputUtils,
50
- LabelUtils, LinkUtils, TableUtils, TabUtils
51
- )
52
-
53
- # Example: Set a Date Value
54
- DateUtils.set_date_value("date_field_id", "2023-10-01")
55
-
56
- # Example: Click a Button
57
- ButtonUtils.click_button("submit_button_id")
58
-
59
- # Example: Select a Dropdown Value
60
- DropdownUtils.select_value("dropdown_id", "Option 1")
61
-
62
- # Example: Enter Text in an Input Field
63
- InputUtils.enter_text("input_field_id", "Sample Text")
64
-
65
- # Example: Click a Link
66
- LinkUtils.click_link("link_id")
67
-
68
- # Example: Click a Tab
69
- TabUtils.click_tab("tab_id")
70
-
71
- # Example: Get a Table Cell Value
72
- TableUtils.get_cell_value("table_id", 1, 2) # Row 1, Column 2
73
-
74
- # Example: Get a Label Value
75
- LabelUtils.get_label_value("label_id")
76
-
77
- # Example: Get a Component Value
78
- ComponentUtils.get_component_value("component_id")
79
-
80
- # Example: Use the Component Driver
81
- from robo_appian.utils.controllers.ComponentDriver import ComponentDriver
82
- ComponentDriver.execute(wait, "Button", "Click", "Submit", None)
83
-
84
- ## Dependencies
85
-
86
- Python >= 3.8
87
- Uses selenium
88
-
89
- ## License
90
-
91
- MIT License. See LICENSE.
@@ -1,20 +0,0 @@
1
- robo_appian/__init__.py,sha256=AiMpl0fcPrlwMyUH0ZRzVYAlv4WY6e225XQCMuJa0Zk,779
2
- robo_appian/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- robo_appian/utils/components/ButtonUtils.py,sha256=Go_F2yJbGHho06notteHU3kXAdpA9EvXw1zm4zp260s,2204
4
- robo_appian/utils/components/ComponentUtils.py,sha256=-6CSRa2mBCPt9BrKXXO1cP6IsZ6Tle1X3rlfoJZlpjc,11779
5
- robo_appian/utils/components/DateUtils.py,sha256=r-4XnuGwA_cSHjWQub7-qoQQ29eBsG14uumXZkXpcDI,4615
6
- robo_appian/utils/components/DropdownUtils.py,sha256=GbH5iHvjunENhm5K4WUXEQhmsEtSBn54Z04Ow1QDEwE,6216
7
- robo_appian/utils/components/InputUtils.py,sha256=AlVbSNMXgbGa1eoTWSGJlOoaQxZxgsSKkhsA__FHRVA,7032
8
- robo_appian/utils/components/LabelUtils.py,sha256=5ovTy9OY-QtLS8UoBXeqi4MQDvlPqVWDnp7SIcXWkJw,1230
9
- robo_appian/utils/components/LinkUtils.py,sha256=T7dJ5xSXp436VXhczWrQHC13L5wXTXxxgAvBdyKuYM4,1420
10
- robo_appian/utils/components/TabUtils.py,sha256=_KsImdeVITxmotphaqVARwhOhAvs4CLWHlx9wr-qZTk,2070
11
- robo_appian/utils/components/TableUtils.py,sha256=W-5fpjRStCmSLlryeHvBiOH83qCXNHgeVukMS3iAs6o,8276
12
- robo_appian/utils/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- robo_appian/utils/controllers/ComponentDriver.py,sha256=Lzhlf7W85FjZn_0j9eybrgC8wSCzUEvsAbgbGNvTMLY,4128
14
- robo_appian/utils/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- robo_appian/utils/exceptions/MyCustomError.py,sha256=DVAkytXNNQNjqyTyCjk6FFd6fr3AsBe57Y19erDSqVs,222
16
- robo_appian/utils/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- robo_appian-0.0.3.dist-info/LICENSE,sha256=g-xR4dRa9_4iFkMoJmED-wE-J5hoxbk3105Knhfpjm0,1068
18
- robo_appian-0.0.3.dist-info/METADATA,sha256=Vawue3RBemMAIGR0Eczb5_3BVm-vD-rj26yNox28FWQ,2586
19
- robo_appian-0.0.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
20
- robo_appian-0.0.3.dist-info/RECORD,,