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.
Metadata
Release files for infrasonar-selenium 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| infrasonar_selenium-1.0.4.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| infrasonar_selenium-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / infrasonar_selenium-1.0.4.tar.gz
| Download URL | infrasonar_selenium-1.0.4.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
188de08876c8e11d8b704136d8bbb99388dd707c688345e10fd963592b09993d
|
|
BLAKE2b-256 checksum How to use checksums |
e69b8f4e07572405dfd6162da0c7a1bd097e2e997cafc51246271a3086a82121
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / infrasonar_selenium-1.0.4-py3-none-any.whl
| Download URL | infrasonar_selenium-1.0.4-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
260d4b5721b26f752a5722f698be447eb41d25b6286eb4391cc9e3330a3f7575
|
|
BLAKE2b-256 checksum How to use checksums |
76fdd0a7fc5b81d02775e88a6ae36a8df4039003e6e5578d697463483e73075b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|