Web Automation Framework
This is a project designed to minimize the setup and config of selenium and actions performed on elements
To use this library, create a snippet like below and populate the actions in the run method (remove the pass keyword)
from web_automation.framework import Framework, Browser, By
class CustomClass(Framework):
def run(self):
pass
CustomClass(
browser=Browser.CHROME,
wait=10,
headless=False,
download_path=''
)
The Constructor accepts 4 params (only one mandatory: browser) which is applied across the automation session
browser: Browser- The type of browser that you want to use, based on theBrowserclasswait: int- The wait time for an element before throwingNoSuchElementExceptionexception, default value is30secondsheadless: bool- Boolean option to set the automation to use the browser in headless mode (runs in background and no visible browser window), default value isFalsedownload-path: str- the path to store the downloaded files, default value is the system download folder
Browser Class
The Browser enum from the module will provide the target browser required to run the automation.
The supported browsers are
- Google Chrome
- Microsoft Edge
- Mozilla Firefox
- Safari
Element selection
The HTML elements in the browser can be selected using one of the below attributes
- id
- name
- tag name
- class name
- css selector
- xpath
- link text
- partial link text
These selectors are provided using the By class (Selenium Class)
SelectBy Class
There are different ways to select an option in the dropdown menu. The SelectBy enum has the below listed options to select the item in the dropdown
- Index
- Text
- Value
Actions Available
The below methods are available in the Framework Class and should be used inside the run method prefixing self.
-
type(elem_type, elem_id, value, clear)- used to type thevaluein the elementelem_type: By- one of the options fromByelem_id: str- element ID value based on theelem_typevalue: str- value to be typed in the componentclear: bool- Boolean value to clear the element before typing
-
click(elem_type, elem_id)- used to click the elementelem_type: By- one fo the options fromByelem_id: str- element ID value based on theelem_type
-
select(elem_type, elem_id, select_by, value)- used to select an options from the dropdown inputelem_type: By- one of the options fromByelem_id: str- element ID value based on theelem_typeselect_by: SelectBy- one of the options fromSelectByvalue: str- value for theSelectByoption type
-
deselect(elem_type, elem_id)- used to deselect a dropdown listelem_type: By- one of the options fromByelem_id: str- element ID value based on theelem_type
-
check_if_exists(elem_type, elem_id)- used to check if the mentioned element exists in the pageelem_type: By- one of the options fromByelem_id: str- element ID value based on theelem_type
-
navigate_to(url)- used to navigate to the mentioned urlurl: str- Target url to be navigated to
-
wait(wait_time)- wait for mentioned timewait_time: int- wait for the mentioned number of seconds
Release files for web-automation 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| web-automation-1.0.1.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| web_automation-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:12.6 kB
Release files / web-automation-1.0.1.tar.gz
| Download URL | web-automation-1.0.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb1856949a1bee377dd9d8f336e376119fbed47c59b3247b77b98c3b6bc8f4bc
|
|
BLAKE2b-256 checksum How to use checksums |
1bba95641cd9e8e1f2c42e1a31e4e0b76ae7ec2e5310aaac5c6f90d904c8d0be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.5
|
Release files / web_automation-1.0.1-py3-none-any.whl
| Download URL | web_automation-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5dd9c84b10269574b02d4dd71292e9cd1e88af410dfbef4da2afca1f8a014fdb
|
|
BLAKE2b-256 checksum How to use checksums |
bb5b9e095a5bb8aaeaaa69536e9f3f79df8af9c4661ab2e1d26408451643cbcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.5
|