robo_appian 0.0.10__py3-none-any.whl → 0.0.12__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 +20 -42
- robo_appian/components/DateUtils.py +43 -111
- robo_appian/components/DropdownUtils.py +203 -136
- 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 +75 -0
- 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 +7 -10
- robo_appian/utils/ComponentUtils.py +6 -3
- {robo_appian-0.0.10.dist-info → robo_appian-0.0.12.dist-info}/METADATA +1 -1
- robo_appian-0.0.12.dist-info/RECORD +22 -0
- robo_appian-0.0.10.dist-info/RECORD +0 -21
- {robo_appian-0.0.10.dist-info → robo_appian-0.0.12.dist-info}/LICENSE +0 -0
- {robo_appian-0.0.10.dist-info → robo_appian-0.0.12.dist-info}/WHEEL +0 -0
|
@@ -5,14 +5,16 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
|
5
5
|
|
|
6
6
|
class LinkUtils:
|
|
7
7
|
"""
|
|
8
|
-
Utility class for
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Click a link with a specific label
|
|
8
|
+
Utility class for handling link operations in Selenium WebDriver.
|
|
9
|
+
Example usage:
|
|
10
|
+
from selenium import webdriver
|
|
11
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
13
12
|
from robo_appian.components.LinkUtils import LinkUtils
|
|
14
|
-
LinkUtils.click(wait, "Learn More")
|
|
15
13
|
|
|
14
|
+
driver = webdriver.Chrome()
|
|
15
|
+
wait = WebDriverWait(driver, 10)
|
|
16
|
+
LinkUtils.click(wait, "Learn More")
|
|
17
|
+
driver.quit()
|
|
16
18
|
"""
|
|
17
19
|
|
|
18
20
|
@staticmethod
|
|
@@ -21,9 +23,7 @@ class LinkUtils:
|
|
|
21
23
|
try:
|
|
22
24
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
23
25
|
except TimeoutError as e:
|
|
24
|
-
raise TimeoutError(
|
|
25
|
-
f"Could not find clickable link with label '{label}': {e}"
|
|
26
|
-
)
|
|
26
|
+
raise TimeoutError(f"Could not find clickable link with label '{label}': {e}")
|
|
27
27
|
except Exception as e:
|
|
28
28
|
raise Exception(f"Could not find clickable link with label '{label}': {e}")
|
|
29
29
|
return component
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
2
|
+
from selenium.webdriver.support import expected_conditions as EC
|
|
3
|
+
from selenium.webdriver.common.by import By
|
|
4
|
+
from robo_appian.components.InputUtils import InputUtils
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SearchDropdownUtils:
|
|
8
|
+
"""
|
|
9
|
+
Utility class for interacting with search dropdown components in Appian UI.
|
|
10
|
+
Usage Example:
|
|
11
|
+
# Select a value from a search dropdown
|
|
12
|
+
from robo_appian.components.SearchDropdownUtils import SearchDropdownUtils
|
|
13
|
+
SearchDropdownUtils.selectSearchDropdownValueByLabelText(wait, "Status", "Approved")
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def __selectSearchDropdownValueByDropdownOptionId(wait, component_id, dropdown_option_id, value):
|
|
18
|
+
input_component_id = str(component_id) + "_searchInput"
|
|
19
|
+
try:
|
|
20
|
+
input_component = wait.until(EC.element_to_be_clickable((By.ID, input_component_id)))
|
|
21
|
+
except Exception as e:
|
|
22
|
+
raise RuntimeError(f"Failed to locate or click input component with ID '{input_component_id}': {e}")
|
|
23
|
+
InputUtils._setValueByComponent(input_component, value)
|
|
24
|
+
|
|
25
|
+
xpath = f'.//ul[@id="{dropdown_option_id}"]/li[./div[normalize-space(text())="{value}"]][1]'
|
|
26
|
+
try:
|
|
27
|
+
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
28
|
+
except Exception as e:
|
|
29
|
+
raise RuntimeError(f"Failed to locate or click dropdown option with XPath '{xpath}': {e}")
|
|
30
|
+
component.click()
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def __selectSearchDropdownValueByPartialLabelText(wait: WebDriverWait, label: str, value: str):
|
|
34
|
+
xpath = f'.//div[./div/span[contains(normalize-space(text()), "{label}")]]/div/div/div/div[@role="combobox" and not(@aria-disabled="true")]'
|
|
35
|
+
try:
|
|
36
|
+
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
37
|
+
except Exception as e:
|
|
38
|
+
raise RuntimeError(f"Failed to locate or click dropdown component with XPath '{xpath}': {e}")
|
|
39
|
+
component_id = component.get_attribute("aria-labelledby")
|
|
40
|
+
dropdown_id = component.get_attribute("aria-controls")
|
|
41
|
+
component.click()
|
|
42
|
+
|
|
43
|
+
SearchDropdownUtils.__selectSearchDropdownValueByDropdownOptionId(wait, component_id, dropdown_id, value)
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def __selectSearchDropdownValueByLabelText(wait: WebDriverWait, label: str, value: str):
|
|
47
|
+
xpath = f'.//div[./div/span[normalize-space(text())="{label}"]]/div/div/div/div[@role="combobox" and not(@aria-disabled="true")]'
|
|
48
|
+
try:
|
|
49
|
+
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
50
|
+
except Exception as e:
|
|
51
|
+
raise RuntimeError(f"Failed to locate or click dropdown component with XPath '{xpath}': {e}")
|
|
52
|
+
component_id = component.get_attribute("aria-labelledby")
|
|
53
|
+
dropdown_option_id = component.get_attribute("aria-controls")
|
|
54
|
+
component.click()
|
|
55
|
+
SearchDropdownUtils.__selectSearchDropdownValueByDropdownOptionId(wait, component_id, dropdown_option_id, value)
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def selectSearchDropdownValueByLabelText(wait: WebDriverWait, dropdown_label: str, value: str):
|
|
59
|
+
"""Selects a value from a search dropdown by label text.
|
|
60
|
+
Args:
|
|
61
|
+
wait (WebDriverWait): The WebDriverWait instance to use for waiting.
|
|
62
|
+
dropdown_label (str): The label text of the dropdown.
|
|
63
|
+
value (str): The value to select from the dropdown.
|
|
64
|
+
"""
|
|
65
|
+
SearchDropdownUtils.__selectSearchDropdownValueByLabelText(wait, dropdown_label, value)
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def selectSearchDropdownValueByPartialLabelText(wait: WebDriverWait, dropdown_label: str, value: str):
|
|
69
|
+
"""Selects a value from a search dropdown by partial label text.
|
|
70
|
+
Args:
|
|
71
|
+
wait (WebDriverWait): The WebDriverWait instance to use for waiting.
|
|
72
|
+
dropdown_label (str): The label text of the dropdown.
|
|
73
|
+
value (str): The value to select from the dropdown.
|
|
74
|
+
"""
|
|
75
|
+
SearchDropdownUtils.__selectSearchDropdownValueByPartialLabelText(wait, dropdown_label, value)
|
|
@@ -6,22 +6,31 @@ from robo_appian.utils.ComponentUtils import ComponentUtils
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class SearchInputUtils:
|
|
9
|
+
"""
|
|
10
|
+
Utility class for handling search input operations in Selenium WebDriver.
|
|
11
|
+
Example usage:
|
|
12
|
+
from selenium import webdriver
|
|
13
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
14
|
+
from robo_appian.components.SearchInputUtils import SearchInputUtils
|
|
15
|
+
|
|
16
|
+
driver = webdriver.Chrome()
|
|
17
|
+
wait = WebDriverWait(driver, 10)
|
|
18
|
+
SearchInputUtils.selectSearchDropdownByLabelText(wait, "Search Label", "Value")
|
|
19
|
+
driver.quit()
|
|
20
|
+
"""
|
|
21
|
+
|
|
9
22
|
@staticmethod
|
|
10
|
-
def __findSearchInputComponentsByLabelPathAndSelectValue(
|
|
11
|
-
wait: WebDriverWait, xpath: str, value: str
|
|
12
|
-
):
|
|
23
|
+
def __findSearchInputComponentsByLabelPathAndSelectValue(wait: WebDriverWait, xpath: str, value: str):
|
|
13
24
|
search_input_components = ComponentUtils.findComponentsByXPath(wait, xpath)
|
|
14
25
|
input_components = []
|
|
15
26
|
for search_input_component in search_input_components:
|
|
16
27
|
attribute: str = "aria-controls"
|
|
17
28
|
dropdown_list_id = search_input_component.get_attribute(attribute)
|
|
18
29
|
if dropdown_list_id:
|
|
19
|
-
InputUtils.
|
|
30
|
+
InputUtils._setValueByComponent(search_input_component, value)
|
|
20
31
|
xpath = f".//ul[@id='{dropdown_list_id}' and @role='listbox' ]/li[@role='option']/div/div/div/div/div/div/p[text()='{value}'][1]"
|
|
21
32
|
try:
|
|
22
|
-
drop_down_item = wait.until(
|
|
23
|
-
EC.element_to_be_clickable((By.XPATH, xpath))
|
|
24
|
-
)
|
|
33
|
+
drop_down_item = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
25
34
|
except TimeoutError as e:
|
|
26
35
|
raise TimeoutError(
|
|
27
36
|
f"Dropdown item with value '{value}' not found for component '{search_input_component.text}'."
|
|
@@ -39,33 +48,19 @@ class SearchInputUtils:
|
|
|
39
48
|
return input_components
|
|
40
49
|
|
|
41
50
|
@staticmethod
|
|
42
|
-
def __selectSearchInputComponentsByPartialLabelText(
|
|
43
|
-
wait: WebDriverWait, label: str, value: str
|
|
44
|
-
):
|
|
51
|
+
def __selectSearchInputComponentsByPartialLabelText(wait: WebDriverWait, label: str, value: str):
|
|
45
52
|
xpath = f".//div[./div/span[contains(normalize-space(text())='{label}']]/div/div/div/input[@role='combobox']"
|
|
46
|
-
SearchInputUtils.__findSearchInputComponentsByLabelPathAndSelectValue(
|
|
47
|
-
wait, xpath, value
|
|
48
|
-
)
|
|
53
|
+
SearchInputUtils.__findSearchInputComponentsByLabelPathAndSelectValue(wait, xpath, value)
|
|
49
54
|
|
|
50
55
|
@staticmethod
|
|
51
|
-
def __selectSearchInputComponentsByLabelText(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
xpath = (
|
|
55
|
-
f".//div[./div/span[text()='{label}']]/div/div/div/input[@role='combobox']"
|
|
56
|
-
)
|
|
57
|
-
SearchInputUtils.__findSearchInputComponentsByLabelPathAndSelectValue(
|
|
58
|
-
wait, xpath, value
|
|
59
|
-
)
|
|
56
|
+
def __selectSearchInputComponentsByLabelText(wait: WebDriverWait, label: str, value: str):
|
|
57
|
+
xpath = f".//div[./div/span[text()='{label}']]/div/div/div/input[@role='combobox']"
|
|
58
|
+
SearchInputUtils.__findSearchInputComponentsByLabelPathAndSelectValue(wait, xpath, value)
|
|
60
59
|
|
|
61
60
|
@staticmethod
|
|
62
61
|
def selectSearchDropdownByLabelText(wait: WebDriverWait, label: str, value: str):
|
|
63
62
|
SearchInputUtils.__selectSearchInputComponentsByLabelText(wait, label, value)
|
|
64
63
|
|
|
65
64
|
@staticmethod
|
|
66
|
-
def selectSearchDropdownByPartialLabelText(
|
|
67
|
-
wait
|
|
68
|
-
):
|
|
69
|
-
SearchInputUtils.__selectSearchInputComponentsByPartialLabelText(
|
|
70
|
-
wait, label, value
|
|
71
|
-
)
|
|
65
|
+
def selectSearchDropdownByPartialLabelText(wait: WebDriverWait, label: str, value: str):
|
|
66
|
+
SearchInputUtils.__selectSearchInputComponentsByPartialLabelText(wait, label, value)
|
|
@@ -4,36 +4,35 @@ from selenium.webdriver.support import expected_conditions as EC
|
|
|
4
4
|
|
|
5
5
|
class TabUtils:
|
|
6
6
|
"""
|
|
7
|
-
Utility class for
|
|
7
|
+
Utility class for handling tab components in a web application using Selenium.
|
|
8
|
+
Example usage:
|
|
9
|
+
from selenium import webdriver
|
|
10
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
11
|
+
from robo_appian.components.TabUtils import TabUtils
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
driver = webdriver.Chrome()
|
|
14
|
+
wait = WebDriverWait(driver, 10)
|
|
10
15
|
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
TabUtils.selectInactiveTab(wait, "Settings")
|
|
16
|
+
# Find a selected tab by its label
|
|
17
|
+
selected_tab = TabUtils.findSelectedTabByLabelText(wait, "Tab Label")
|
|
14
18
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
# Select an inactive tab by its label
|
|
20
|
+
TabUtils.selectInactiveTabByLabelText(wait, "Inactive Tab Label")
|
|
21
|
+
|
|
22
|
+
driver.quit()
|
|
18
23
|
"""
|
|
19
24
|
|
|
20
25
|
@staticmethod
|
|
21
|
-
def
|
|
26
|
+
def findSelectedTabByLabelText(wait, label):
|
|
22
27
|
"""
|
|
23
28
|
Finds the currently selected tab by its label.
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
The Selenium WebElement for the selected tab.
|
|
31
|
-
|
|
30
|
+
:param wait: Selenium WebDriverWait instance.
|
|
31
|
+
:param label: The label of the tab to find.
|
|
32
|
+
:return: WebElement representing the selected tab.
|
|
32
33
|
Example:
|
|
33
|
-
TabUtils.
|
|
34
|
+
component = TabUtils.findSelectedTabByLabelText(wait, "Tab Label")
|
|
34
35
|
"""
|
|
35
|
-
# This method locates a tab that is currently selected and contains the specified label.
|
|
36
|
-
|
|
37
36
|
xpath = f".//div[./div[./div/div/div/div/div/p/strong[normalize-space(text())='{label}']]/span[text()='Selected Tab.']]/div[@role='link']"
|
|
38
37
|
try:
|
|
39
38
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
@@ -44,21 +43,17 @@ class TabUtils:
|
|
|
44
43
|
return component
|
|
45
44
|
|
|
46
45
|
@staticmethod
|
|
47
|
-
def
|
|
46
|
+
def selectInactiveTabByLabelText(wait, label):
|
|
48
47
|
"""
|
|
49
|
-
Selects
|
|
50
|
-
|
|
51
|
-
Parameters:
|
|
52
|
-
wait: Selenium WebDriverWait instance.
|
|
53
|
-
label: The visible text label of the tab to select.
|
|
48
|
+
Selects an inactive tab by its label.
|
|
54
49
|
|
|
50
|
+
:param wait: Selenium WebDriverWait instance.
|
|
51
|
+
:param label: The label of the tab to select.
|
|
52
|
+
:return: None
|
|
55
53
|
Example:
|
|
56
|
-
TabUtils.
|
|
54
|
+
TabUtils.selectInactiveTabByLabelText(wait, "Tab Label")
|
|
57
55
|
"""
|
|
58
|
-
# This method locates a tab that contains a label with the specified text.
|
|
59
|
-
|
|
60
56
|
xpath = f".//div[@role='link']/div/div/div/div/div[./p/span[text()='{label}']]"
|
|
61
|
-
# xpath=f".//div[./div[./div/div/div/div/div/p/strong[normalize-space(text())='{label}']]/span[text()='Selected Tab.']]/div[@role='link']"
|
|
62
57
|
try:
|
|
63
58
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
64
59
|
except TimeoutError as e:
|
|
@@ -5,98 +5,77 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
|
5
5
|
|
|
6
6
|
class TableUtils:
|
|
7
7
|
"""
|
|
8
|
-
Utility class for
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Find a table using a column name
|
|
8
|
+
Utility class for handling table operations in Selenium WebDriver.
|
|
9
|
+
Example usage:
|
|
10
|
+
from selenium import webdriver
|
|
11
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
13
12
|
from robo_appian.components.TableUtils import TableUtils
|
|
13
|
+
|
|
14
|
+
driver = webdriver.Chrome()
|
|
15
|
+
wait = WebDriverWait(driver, 10)
|
|
14
16
|
table = TableUtils.findTableByColumnName(wait, "Status")
|
|
17
|
+
row_count = TableUtils.rowCount(table)
|
|
18
|
+
component = TableUtils.findComponentFromTableCell(wait, 1, "Status")
|
|
19
|
+
driver.quit()
|
|
15
20
|
|
|
16
21
|
"""
|
|
17
22
|
|
|
18
23
|
@staticmethod
|
|
19
24
|
def findTableByColumnName(wait: WebDriverWait, columnName: str):
|
|
20
25
|
"""
|
|
21
|
-
Finds a table component
|
|
22
|
-
|
|
23
|
-
Parameters:
|
|
24
|
-
wait: Selenium WebDriverWait instance.
|
|
25
|
-
columnName: The name of the column to search for in the table.
|
|
26
|
-
|
|
27
|
-
Returns:
|
|
28
|
-
The Selenium WebElement for the table component.
|
|
26
|
+
Finds a table component by its column name.
|
|
29
27
|
|
|
28
|
+
:param wait: Selenium WebDriverWait instance.
|
|
29
|
+
:param columnName: The name of the column to search for.
|
|
30
|
+
:return: WebElement representing the table.
|
|
30
31
|
Example:
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
component = TableUtils.findTableByColumnName(wait, "Status")
|
|
33
33
|
"""
|
|
34
|
-
# This method locates a table that contains a header cell with the specified column name.
|
|
35
|
-
# It uses XPath to find the table element that has a header cell with the specified 'columnName'.
|
|
36
|
-
# The 'abbr' attribute is used to match the column name, which is a common practice in Appian UI tables.
|
|
37
34
|
|
|
38
|
-
# xpath = f".//table[./thead/tr/th[@abbr='{columnName}']]"
|
|
39
35
|
xpath = f'.//table[./thead/tr/th[@abbr="{columnName}"]]'
|
|
40
36
|
try:
|
|
41
37
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
42
38
|
except TimeoutError as e:
|
|
43
|
-
raise TimeoutError(
|
|
44
|
-
f"Could not find table with column name '{columnName}': {e}"
|
|
45
|
-
)
|
|
39
|
+
raise TimeoutError(f"Could not find table with column name '{columnName}': {e}")
|
|
46
40
|
except Exception as e:
|
|
47
|
-
raise RuntimeError(
|
|
48
|
-
f"Could not find table with column name '{columnName}': {e}"
|
|
49
|
-
)
|
|
41
|
+
raise RuntimeError(f"Could not find table with column name '{columnName}': {e}")
|
|
50
42
|
return component
|
|
51
43
|
|
|
52
44
|
@staticmethod
|
|
53
45
|
def rowCount(tableObject):
|
|
54
46
|
"""
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Parameters:
|
|
58
|
-
tableObject: The Selenium WebElement representing the table.
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
The number of rows in the table.
|
|
47
|
+
Counts the number of rows in a table.
|
|
62
48
|
|
|
49
|
+
:param tableObject: The Selenium WebElement representing the table.
|
|
50
|
+
:return: The number of rows in the table.
|
|
63
51
|
Example:
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
row_count = TableUtils.rowCount(table)
|
|
66
53
|
"""
|
|
67
|
-
# This method counts the number of rows in a table by finding all the table row elements
|
|
68
|
-
# that do not have the 'data-empty-grid-message' attribute.
|
|
69
54
|
|
|
70
55
|
xpath = "./tbody/tr[./td[not (@data-empty-grid-message)]]"
|
|
71
|
-
|
|
56
|
+
try:
|
|
57
|
+
rows = tableObject.find_elements(By.XPATH, xpath)
|
|
58
|
+
except Exception as e:
|
|
59
|
+
raise RuntimeError(f"Could not count rows in table: {e}")
|
|
72
60
|
return len(rows)
|
|
73
61
|
|
|
74
62
|
@staticmethod
|
|
75
|
-
def
|
|
63
|
+
def __findColumNumberByColumnName(tableObject, columnName):
|
|
76
64
|
"""
|
|
77
|
-
Finds the column number in a table
|
|
78
|
-
|
|
79
|
-
Parameters:
|
|
80
|
-
tableObject: The Selenium WebElement representing the table.
|
|
81
|
-
columnName: The name of the column to find.
|
|
82
|
-
|
|
83
|
-
Returns:
|
|
84
|
-
The index of the column (0-based).
|
|
65
|
+
Finds the column number in a table by its column name.
|
|
85
66
|
|
|
67
|
+
:param tableObject: The Selenium WebElement representing the table.
|
|
68
|
+
:param columnName: The name of the column to search for.
|
|
69
|
+
:return: The index of the column (0-based).
|
|
86
70
|
Example:
|
|
87
|
-
column_number = TableUtils.
|
|
88
|
-
|
|
71
|
+
column_number = TableUtils.__findColumNumberByColumnName(table, "Status")
|
|
89
72
|
"""
|
|
90
|
-
# This method locates the column header cell with the specified column name
|
|
91
|
-
# and extracts the column index from its class attribute.
|
|
92
73
|
|
|
93
74
|
xpath = f'./thead/tr/th[@scope="col" and @abbr="{columnName}"]'
|
|
94
75
|
component = tableObject.find_element(By.XPATH, xpath)
|
|
95
76
|
|
|
96
77
|
if component is None:
|
|
97
|
-
raise ValueError(
|
|
98
|
-
f"Could not find a column with abbr '{columnName}' in the table header."
|
|
99
|
-
)
|
|
78
|
+
raise ValueError(f"Could not find a column with abbr '{columnName}' in the table header.")
|
|
100
79
|
|
|
101
80
|
class_string = component.get_attribute("class")
|
|
102
81
|
partial_string = "headCell_"
|
|
@@ -108,9 +87,7 @@ class TableUtils:
|
|
|
108
87
|
selected_word = word
|
|
109
88
|
|
|
110
89
|
if selected_word is None:
|
|
111
|
-
raise ValueError(
|
|
112
|
-
f"Could not find a class containing '{partial_string}' in the column header for '{columnName}'."
|
|
113
|
-
)
|
|
90
|
+
raise ValueError(f"Could not find a class containing '{partial_string}' in the column header for '{columnName}'.")
|
|
114
91
|
|
|
115
92
|
data = selected_word.split("_")
|
|
116
93
|
return int(data[1])
|
|
@@ -118,26 +95,18 @@ class TableUtils:
|
|
|
118
95
|
@staticmethod
|
|
119
96
|
def findComponentFromTableCell(wait, rowNumber, columnName):
|
|
120
97
|
"""
|
|
121
|
-
Finds a component within a specific
|
|
122
|
-
|
|
123
|
-
Parameters:
|
|
124
|
-
wait: Selenium WebDriverWait instance.
|
|
125
|
-
rowNumber: The row number (0-based index) where the component is located.
|
|
126
|
-
columnName: The name of the column where the component is located.
|
|
127
|
-
|
|
128
|
-
Returns:
|
|
129
|
-
The Selenium WebElement for the component within the specified table cell.
|
|
98
|
+
Finds a component within a specific cell of a table by row number and column name.
|
|
130
99
|
|
|
100
|
+
:param wait: Selenium WebDriverWait instance.
|
|
101
|
+
:param rowNumber: The row number (0-based index).
|
|
102
|
+
:param columnName: The name of the column to search in.
|
|
103
|
+
:return: WebElement representing the component in the specified cell.
|
|
131
104
|
Example:
|
|
132
|
-
component = TableUtils.findComponentFromTableCell(wait,
|
|
133
|
-
|
|
105
|
+
component = TableUtils.findComponentFromTableCell(wait, 1, "Status")
|
|
134
106
|
"""
|
|
135
|
-
# This method locates a specific component within a table cell based on the provided row number
|
|
136
|
-
# and column name. It constructs an XPath that targets the table cell containing the specified column
|
|
137
|
-
# and row, and then retrieves the component within that cell.
|
|
138
107
|
|
|
139
108
|
tableObject = TableUtils.findTableByColumnName(wait, columnName)
|
|
140
|
-
columnNumber = TableUtils.
|
|
109
|
+
columnNumber = TableUtils.__findColumNumberByColumnName(tableObject, columnName)
|
|
141
110
|
# xpath=f'./tbody/tr[@data-dnd-name="row {rowNumber+1}"]/td[not (@data-empty-grid-message)][{columnNumber}]'
|
|
142
111
|
# component = tableObject.find_elements(By.XPATH, xpath)
|
|
143
112
|
rowNumber = rowNumber + 1
|
|
@@ -146,12 +115,8 @@ class TableUtils:
|
|
|
146
115
|
try:
|
|
147
116
|
component = wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))
|
|
148
117
|
except TimeoutError as e:
|
|
149
|
-
raise TimeoutError(
|
|
150
|
-
f"Could not find component in cell at row {rowNumber}, column '{columnName}': {e}"
|
|
151
|
-
)
|
|
118
|
+
raise TimeoutError(f"Could not find component in cell at row {rowNumber}, column '{columnName}': {e}")
|
|
152
119
|
except Exception as e:
|
|
153
|
-
raise RuntimeError(
|
|
154
|
-
f"Could not find component in cell at row {rowNumber}, column '{columnName}': {e}"
|
|
155
|
-
)
|
|
120
|
+
raise RuntimeError(f"Could not find component in cell at row {rowNumber}, column '{columnName}': {e}")
|
|
156
121
|
# childComponent=component.find_element(By.xpath("./*"))
|
|
157
122
|
return component
|
|
@@ -7,6 +7,7 @@ from robo_appian.components.LabelUtils import LabelUtils
|
|
|
7
7
|
from robo_appian.components.LinkUtils import LinkUtils
|
|
8
8
|
from robo_appian.components.TabUtils import TabUtils
|
|
9
9
|
from robo_appian.components.SearchInputUtils import SearchInputUtils
|
|
10
|
+
from robo_appian.components.SearchDropdownUtils import SearchDropdownUtils
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class ComponentDriver:
|
|
@@ -37,7 +38,7 @@ class ComponentDriver:
|
|
|
37
38
|
case "Date":
|
|
38
39
|
match action:
|
|
39
40
|
case "Set Value":
|
|
40
|
-
DateUtils.
|
|
41
|
+
DateUtils.setValueByLabelText(wait, label, value)
|
|
41
42
|
case _:
|
|
42
43
|
raise ValueError(f"Unsupported action for {type}: {action}")
|
|
43
44
|
case "Input Text":
|
|
@@ -49,15 +50,13 @@ class ComponentDriver:
|
|
|
49
50
|
case "Search Input Text":
|
|
50
51
|
match action:
|
|
51
52
|
case "Select":
|
|
52
|
-
SearchInputUtils.selectSearchDropdownByLabelText(
|
|
53
|
-
wait, label, value
|
|
54
|
-
)
|
|
53
|
+
SearchInputUtils.selectSearchDropdownByLabelText(wait, label, value)
|
|
55
54
|
case _:
|
|
56
55
|
raise ValueError(f"Unsupported action for {type}: {action}")
|
|
57
56
|
case "Label":
|
|
58
57
|
match action:
|
|
59
58
|
case "Find":
|
|
60
|
-
LabelUtils.
|
|
59
|
+
LabelUtils.findByLabelText(wait, label)
|
|
61
60
|
case _:
|
|
62
61
|
raise ValueError(f"Unsupported action for {type}: {action}")
|
|
63
62
|
case "Link":
|
|
@@ -75,21 +74,19 @@ class ComponentDriver:
|
|
|
75
74
|
case "Search Drop Down":
|
|
76
75
|
match action:
|
|
77
76
|
case "Select":
|
|
78
|
-
|
|
79
|
-
wait, label, value
|
|
80
|
-
)
|
|
77
|
+
SearchDropdownUtils.selectSearchDropdownValueByLabelText(wait, label, value)
|
|
81
78
|
case _:
|
|
82
79
|
raise ValueError(f"Unsupported action for {type}: {action}")
|
|
83
80
|
case "Button":
|
|
84
81
|
match action:
|
|
85
82
|
case "Click":
|
|
86
|
-
ButtonUtils.
|
|
83
|
+
ButtonUtils.clickByLabelText(wait, label)
|
|
87
84
|
case _:
|
|
88
85
|
raise ValueError(f"Unsupported action for {type}: {action}")
|
|
89
86
|
case "Tab":
|
|
90
87
|
match action:
|
|
91
88
|
case "Find":
|
|
92
|
-
TabUtils.
|
|
89
|
+
TabUtils.findSelectedTabByLabelText(wait, label)
|
|
93
90
|
case _:
|
|
94
91
|
raise ValueError(f"Unsupported action for {type}: {action}")
|
|
95
92
|
case _:
|
|
@@ -4,6 +4,7 @@ from selenium.webdriver.common.by import By
|
|
|
4
4
|
from selenium.webdriver.common.keys import Keys
|
|
5
5
|
from selenium.webdriver.support import expected_conditions as EC
|
|
6
6
|
from selenium.webdriver.remote.webdriver import WebDriver
|
|
7
|
+
from selenium.webdriver.remote.webelement import WebElement
|
|
7
8
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
8
9
|
|
|
9
10
|
|
|
@@ -37,6 +38,10 @@ class ComponentUtils:
|
|
|
37
38
|
yesterday_formatted = yesterday.strftime("%m/%d/%Y")
|
|
38
39
|
return yesterday_formatted
|
|
39
40
|
|
|
41
|
+
@staticmethod
|
|
42
|
+
def findChildComponent(wait: WebDriverWait, component: WebElement, xpath: str):
|
|
43
|
+
return component.find_element(By.XPATH, xpath)
|
|
44
|
+
|
|
40
45
|
@staticmethod
|
|
41
46
|
def findSuccessMessage(wait: WebDriverWait, message: str):
|
|
42
47
|
"""
|
|
@@ -161,9 +166,7 @@ class ComponentUtils:
|
|
|
161
166
|
length = 0
|
|
162
167
|
|
|
163
168
|
try:
|
|
164
|
-
component = wait.until(
|
|
165
|
-
EC.presence_of_all_elements_located((By.XPATH, xpath))
|
|
166
|
-
)
|
|
169
|
+
component = wait.until(EC.presence_of_all_elements_located((By.XPATH, xpath)))
|
|
167
170
|
length = len(component)
|
|
168
171
|
except NoSuchElementException:
|
|
169
172
|
pass
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
robo_appian/__init__.py,sha256=6u9n2W7P1IKSSr5IPGsg7LhVR1o1uYv424mXDjJLgb0,720
|
|
2
|
+
robo_appian/components/ButtonUtils.py,sha256=k6XQcMUFa0u3FuBLwNv9BsvIub6Z8RwoiLx_XsURtjg,2316
|
|
3
|
+
robo_appian/components/DateUtils.py,sha256=9scKYCyJavVyHzoHVfe1cdW2rEp4NAXsP5Zs_CV3fwk,3252
|
|
4
|
+
robo_appian/components/DropdownUtils.py,sha256=OscvU2mAC-ZhTQxB6j4amac4nByGpeu57ak7OLKdyY8,11174
|
|
5
|
+
robo_appian/components/InputUtils.py,sha256=6BqkAhKyUUcn9cTHbP97DuPaVU17kGAftstl310RMaE,6438
|
|
6
|
+
robo_appian/components/LabelUtils.py,sha256=luT_bY720GJF95sA1fWgu8FB0XiupK3fTNG9jmghQ60,1583
|
|
7
|
+
robo_appian/components/LinkUtils.py,sha256=AfJma3ahznMGm771ukAES3qSCBBug6lO5LxzN8PPf6w,1519
|
|
8
|
+
robo_appian/components/SearchDropdownUtils.py,sha256=sSe-GnbLL-Va8RvX_bTkcTSd9uPMfcmROlmRa8BEp1U,4042
|
|
9
|
+
robo_appian/components/SearchInputUtils.py,sha256=FcRazZ_3J-_XvXOwZhV4TVr-t65kWFG2-RjVH8rlkgo,3356
|
|
10
|
+
robo_appian/components/TabUtils.py,sha256=Pq-g61uPbhyfSgC8mt9PBBcdDDnmCcRziltfHGA52qw,2463
|
|
11
|
+
robo_appian/components/TableUtils.py,sha256=do9FvJIjV0hX2pafrIv5A9-NYxwyMZC-Z4k2Wo1yWs4,5039
|
|
12
|
+
robo_appian/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
robo_appian/controllers/ComponentDriver.py,sha256=0GzEXsncWg4oPHGmG48wKeGlrEHxkSX-Ml_NsLIcrvQ,4358
|
|
14
|
+
robo_appian/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
robo_appian/exceptions/MyCustomError.py,sha256=DVAkytXNNQNjqyTyCjk6FFd6fr3AsBe57Y19erDSqVs,222
|
|
16
|
+
robo_appian/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
robo_appian/utils/ComponentUtils.py,sha256=Oa4XMey0Gm9lLF0bumrNBB0Z3BKljjwe9Zq3BSNm4Vk,8578
|
|
18
|
+
robo_appian/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
robo_appian-0.0.12.dist-info/LICENSE,sha256=g-xR4dRa9_4iFkMoJmED-wE-J5hoxbk3105Knhfpjm0,1068
|
|
20
|
+
robo_appian-0.0.12.dist-info/METADATA,sha256=rxUu91o4Rb-_n1ceqkpPGbAdMS2vd4E3S0iLRr0wljk,4105
|
|
21
|
+
robo_appian-0.0.12.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
22
|
+
robo_appian-0.0.12.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
robo_appian/__init__.py,sha256=6u9n2W7P1IKSSr5IPGsg7LhVR1o1uYv424mXDjJLgb0,720
|
|
2
|
-
robo_appian/components/ButtonUtils.py,sha256=oezrvj3n95KE7O-O-bkyvtfzrCzD3GJw7Za9QCYnGuc,2793
|
|
3
|
-
robo_appian/components/DateUtils.py,sha256=yewRjKarXj6xMA0RtiXu_ZshGXEkkhAu1bmq01uug74,5117
|
|
4
|
-
robo_appian/components/DropdownUtils.py,sha256=Fh6RxepV45QMF8bIlrmPtbXE_i3kQlaHCSBVznOSxR4,7736
|
|
5
|
-
robo_appian/components/InputUtils.py,sha256=GDLn3ZZ8YrO6NfNgiRH9q1qaHdsE8v1nZTSH4jc3tgw,5102
|
|
6
|
-
robo_appian/components/LabelUtils.py,sha256=bhMM2_lTyx8839ia__8qXVqAhTvnsgPCe7AIcEFYEN0,1654
|
|
7
|
-
robo_appian/components/LinkUtils.py,sha256=R8B4xj7V6agyz9m2GFt_jQQE8yjHPd6R5T3Pn8YRxCk,1397
|
|
8
|
-
robo_appian/components/SearchInputUtils.py,sha256=EKajPjmeuEHwY4aswHXAEhO8I4igS3icWovK_rZV6K8,3064
|
|
9
|
-
robo_appian/components/TabUtils.py,sha256=e3zk9hPXwynyA0aEIr5DEm2wpSvT8yewqKAUyWYUjzw,2575
|
|
10
|
-
robo_appian/components/TableUtils.py,sha256=X0iA7saWm72Qgz_oZ4dnE3wp8-44Xdj16zzUnazGUIQ,6062
|
|
11
|
-
robo_appian/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
robo_appian/controllers/ComponentDriver.py,sha256=6-zJ9UTpRAwOqk0wlVlE0PCD05DnV54pXFuxw4Mbbk0,4345
|
|
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=gxSmF2LvlNpK6qnKt9JAq76dQjAXq74FDfABsZ36w9o,8390
|
|
17
|
-
robo_appian/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
robo_appian-0.0.10.dist-info/LICENSE,sha256=g-xR4dRa9_4iFkMoJmED-wE-J5hoxbk3105Knhfpjm0,1068
|
|
19
|
-
robo_appian-0.0.10.dist-info/METADATA,sha256=bd5Wja8dut9ScwgtK6yrYvtQ0xTYMPjkPLj9wyDBHFw,4105
|
|
20
|
-
robo_appian-0.0.10.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
21
|
-
robo_appian-0.0.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|