Library for building InfraSonar Selenium tests
Project description
InfraSonar Selenium Test Suite
Requirements
- Python (3.12 or higher)
- Docker
Usage
Make sure the lib is installed:
pip install infrasonar_selenium
Start Selenium:
docker run -d \
-p 4444:4444 \
-p 7900:7900 \
--shm-size="2g" \
ghcr.io/infrasonar/selenium
Note: We prefer the default image as it mirrors the InfraSonar setup. However, you can use a different image like
selenium/standalone-chromeif needed.
Write a test: (for example, save the following to mytest.py)
from infrasonar_selenium import TestBase
from selenium import webdriver
from selenium.webdriver.common.by import By
class MyTest(TestBase):
description = 'Example test'
url = 'https://www.selenium.dev/selenium/web/web-form.html'
version = 'v0'
@classmethod
def test(cls, driver: webdriver.Remote):
title = driver.title
assert title == "Web form"
driver.implicitly_wait(0.5)
text_box = driver.find_element(by=By.NAME, value="my-text")
submit_button = driver.find_element(by=By.CSS_SELECTOR, value="button")
text_box.send_keys("Selenium")
submit_button.click()
message = driver.find_element(by=By.ID, value="message")
value = message.text
assert value == "Received!"
export = MyTest
if __name__ == '__main__':
MyTest().print_run() # Prints the output
Start the test:
python mytest.py
With the following link you can view your scripts in action:
http://localhost:7900/?autoconnect=1&resize=scale&password=secret
The same applies for scripts running with InfraSonar, except replace
localhostwith your appliance server address.
Password and/or Secret
For a password or secret in your script, use the following:
from infrasonar_selenium import get_password, get_secret
password = get_password()
secret = get_secret()
Next, start the script:
PASSWORD=myPassword SECRET=mySecret python mytest.py
For InfraSonar, you can provide the probe with the password and/or secret.
InfraSonar encrypts those and they will never leave your appliance.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infrasonar_selenium-1.0.3.tar.gz.
File metadata
- Download URL: infrasonar_selenium-1.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
464f600b90a73d8e236d331a6f708c97e883c164c9a72ab07073381daed2c5e6
|
|
| MD5 |
5e660248df9c7cdf00bb53262c0d9586
|
|
| BLAKE2b-256 |
2c0cc619957fefd77002036711f0ae8365b2f5a902eda9c8b5e4f4b27c4491b7
|
File details
Details for the file infrasonar_selenium-1.0.3-py3-none-any.whl.
File metadata
- Download URL: infrasonar_selenium-1.0.3-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a410353085e3786cbed9d53144c76a4c765ebceda15eb4362bb0e71ce9a661f
|
|
| MD5 |
83a13f9724d12e97cff5d417a3e72577
|
|
| BLAKE2b-256 |
0aa658c820c2bfc04ff0434e85a410905e6f38e4aa8d196232beffaa96a0ae8d
|