robo_appian 0.0.3__tar.gz → 0.0.5__tar.gz
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-0.0.5/PKG-INFO +140 -0
- robo_appian-0.0.5/README.md +122 -0
- {robo_appian-0.0.3 → robo_appian-0.0.5}/pyproject.toml +6 -1
- robo_appian-0.0.5/robo_appian/__init__.py +23 -0
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/ButtonUtils.py +1 -1
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/DateUtils.py +3 -3
- robo_appian-0.0.5/robo_appian/components/DropdownUtils.py +136 -0
- robo_appian-0.0.5/robo_appian/components/InputUtils.py +107 -0
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/LabelUtils.py +1 -1
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/LinkUtils.py +1 -1
- robo_appian-0.0.5/robo_appian/components/SearchInputUtils.py +64 -0
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/TabUtils.py +2 -2
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/TableUtils.py +8 -1
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/controllers/ComponentDriver.py +18 -13
- {robo_appian-0.0.3/robo_appian/utils/components → robo_appian-0.0.5/robo_appian/utils}/ComponentUtils.py +37 -100
- robo_appian-0.0.3/PKG-INFO +0 -91
- robo_appian-0.0.3/README.md +0 -73
- robo_appian-0.0.3/robo_appian/__init__.py +0 -23
- robo_appian-0.0.3/robo_appian/utils/components/DropdownUtils.py +0 -141
- robo_appian-0.0.3/robo_appian/utils/components/InputUtils.py +0 -189
- {robo_appian-0.0.3 → robo_appian-0.0.5}/LICENSE +0 -0
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian/components}/__init__.py +0 -0
- {robo_appian-0.0.3/robo_appian/utils/components → robo_appian-0.0.5/robo_appian/controllers}/__init__.py +0 -0
- {robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/exceptions/MyCustomError.py +0 -0
- {robo_appian-0.0.3/robo_appian/utils/controllers → robo_appian-0.0.5/robo_appian/exceptions}/__init__.py +0 -0
- {robo_appian-0.0.3/robo_appian/utils/exceptions → robo_appian-0.0.5/robo_appian/utils}/__init__.py +0 -0
|
@@ -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
|
+
[](https://badge.fury.io/py/robo-appian)
|
|
24
|
+
[](https://www.python.org/downloads/)
|
|
25
|
+
[](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,122 @@
|
|
|
1
|
+
# Robo Appian
|
|
2
|
+
|
|
3
|
+
**Automate your Appian code testing with Python. Boost quality, save time.**
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/robo-appian)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://dinilmithra.github.io/robo_appian/)
|
|
8
|
+
|
|
9
|
+
## 🚀 Quick Start
|
|
10
|
+
|
|
11
|
+
### Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install robo-appian
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from selenium import webdriver
|
|
21
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
22
|
+
from robo_appian import ButtonUtils, InputUtils, TableUtils
|
|
23
|
+
|
|
24
|
+
# Setup your driver
|
|
25
|
+
driver = webdriver.Chrome()
|
|
26
|
+
wait = WebDriverWait(driver, 10)
|
|
27
|
+
|
|
28
|
+
# Interact with Appian components
|
|
29
|
+
ButtonUtils.click(wait, "Submit")
|
|
30
|
+
InputUtils.set_text(wait, "Username", "john.doe")
|
|
31
|
+
TableUtils.click_cell_link(wait, "Actions", 1, "Edit")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 📚 Features
|
|
35
|
+
|
|
36
|
+
### Components
|
|
37
|
+
- **ButtonUtils**: Find and click buttons
|
|
38
|
+
- **DateUtils**: Interact with date fields and date pickers
|
|
39
|
+
- **DropdownUtils**: Interact with dropdown/select components
|
|
40
|
+
- **InputUtils**: Interact with input fields and text areas
|
|
41
|
+
- **LabelUtils**: Find and interact with labels
|
|
42
|
+
- **LinkUtils**: Click links and navigate
|
|
43
|
+
- **TableUtils**: Interact with tables and grids
|
|
44
|
+
- **TabUtils**: Switch between tabs
|
|
45
|
+
- **ComponentUtils**: General component utilities
|
|
46
|
+
|
|
47
|
+
### Controllers
|
|
48
|
+
- **ComponentDriver**: High-level interface for component interaction
|
|
49
|
+
|
|
50
|
+
### Exceptions
|
|
51
|
+
- **MyCustomError**: Custom exceptions for better error handling
|
|
52
|
+
|
|
53
|
+
## 📖 Documentation
|
|
54
|
+
|
|
55
|
+
Visit our [full documentation](https://dinilmithra.github.io/robo_appian/) for:
|
|
56
|
+
- Detailed API reference
|
|
57
|
+
- Complete examples and tutorials
|
|
58
|
+
- Installation guide
|
|
59
|
+
- Best practices
|
|
60
|
+
|
|
61
|
+
## 🛠️ Requirements
|
|
62
|
+
|
|
63
|
+
- Python 3.12+
|
|
64
|
+
- Selenium WebDriver 4.34.0+
|
|
65
|
+
- Compatible web browser (Chrome, Firefox, etc.)
|
|
66
|
+
|
|
67
|
+
## 🤝 Contributing
|
|
68
|
+
|
|
69
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
70
|
+
|
|
71
|
+
## 📄 License
|
|
72
|
+
|
|
73
|
+
This project is licensed under the MIT License.
|
|
74
|
+
|
|
75
|
+
## 🔗 Links
|
|
76
|
+
|
|
77
|
+
- [Documentation](https://dinilmithra.github.io/robo_appian/)
|
|
78
|
+
- [PyPI Package](https://pypi.org/project/robo-appian/)
|
|
79
|
+
- [GitHub Repository](https://github.com/dinilmithra/robo_appian)
|
|
80
|
+
ButtonUtils, ComponentUtils, DateUtils, DropdownUtils, InputUtils,
|
|
81
|
+
LabelUtils, LinkUtils, TableUtils, TabUtils
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# Example: Set a Date Value
|
|
85
|
+
DateUtils.set_date_value("date_field_id", "2023-10-01")
|
|
86
|
+
|
|
87
|
+
# Example: Click a Button
|
|
88
|
+
ButtonUtils.click_button("submit_button_id")
|
|
89
|
+
|
|
90
|
+
# Example: Select a Dropdown Value
|
|
91
|
+
DropdownUtils.select_value("dropdown_id", "Option 1")
|
|
92
|
+
|
|
93
|
+
# Example: Enter Text in an Input Field
|
|
94
|
+
InputUtils.enter_text("input_field_id", "Sample Text")
|
|
95
|
+
|
|
96
|
+
# Example: Click a Link
|
|
97
|
+
LinkUtils.click_link("link_id")
|
|
98
|
+
|
|
99
|
+
# Example: Click a Tab
|
|
100
|
+
TabUtils.click_tab("tab_id")
|
|
101
|
+
|
|
102
|
+
# Example: Get a Table Cell Value
|
|
103
|
+
TableUtils.get_cell_value("table_id", 1, 2) # Row 1, Column 2
|
|
104
|
+
|
|
105
|
+
# Example: Get a Label Value
|
|
106
|
+
LabelUtils.get_label_value("label_id")
|
|
107
|
+
|
|
108
|
+
# Example: Get a Component Value
|
|
109
|
+
ComponentUtils.get_component_value("component_id")
|
|
110
|
+
|
|
111
|
+
# Example: Use the Component Driver
|
|
112
|
+
from robo_appian.utils.controllers.ComponentDriver import ComponentDriver
|
|
113
|
+
ComponentDriver.execute(wait, "Button", "Click", "Submit", None)
|
|
114
|
+
|
|
115
|
+
## Dependencies
|
|
116
|
+
|
|
117
|
+
Python >= 3.8
|
|
118
|
+
Uses selenium
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT License. See LICENSE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "robo_appian"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.5"
|
|
4
4
|
description = "Automate your Appian code testing with Python. Boost quality, save time."
|
|
5
5
|
authors = ["Dinil Mithra <dinilmithra@mailme@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -17,6 +17,11 @@ requests = "^2.25.1"
|
|
|
17
17
|
numpy = "*"
|
|
18
18
|
selenium = ">=4.34.0"
|
|
19
19
|
|
|
20
|
+
[tool.poetry.group.dev.dependencies]
|
|
21
|
+
mkdocs = "^1.5.0"
|
|
22
|
+
mkdocs-material = "^9.0.0"
|
|
23
|
+
mkdocstrings = {extras = ["python"], version = "^0.24.0"}
|
|
24
|
+
|
|
20
25
|
[build-system]
|
|
21
26
|
requires = ["poetry-core"]
|
|
22
27
|
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
|
|
11
|
+
__version__ = "0.0.2"
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"ButtonUtils",
|
|
15
|
+
"ComponentUtils",
|
|
16
|
+
"DateUtils",
|
|
17
|
+
"DropdownUtils",
|
|
18
|
+
"InputUtils",
|
|
19
|
+
"LabelUtils",
|
|
20
|
+
"LinkUtils",
|
|
21
|
+
"TableUtils",
|
|
22
|
+
"TabUtils"
|
|
23
|
+
]
|
{robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/ButtonUtils.py
RENAMED
|
@@ -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.
|
|
13
|
+
from robo_appian.components.ButtonUtils import ButtonUtils
|
|
14
14
|
|
|
15
15
|
wait = WebDriverWait(driver, 10)
|
|
16
16
|
ButtonUtils.click(wait, "Login")
|
{robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/DateUtils.py
RENAMED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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)
|
|
@@ -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
|
+
)
|
{robo_appian-0.0.3/robo_appian/utils → robo_appian-0.0.5/robo_appian}/components/TabUtils.py
RENAMED
|
@@ -9,11 +9,11 @@ class TabUtils:
|
|
|
9
9
|
Usage Example:
|
|
10
10
|
|
|
11
11
|
# Select a tab by its label
|
|
12
|
-
from robo_appian.
|
|
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.
|
|
16
|
+
from robo_appian.components.TabUtils import TabUtils
|
|
17
17
|
selected_tab = TabUtils.find_selected_tab(wait, "Settings")
|
|
18
18
|
"""
|
|
19
19
|
|