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" selenium/standalone-chrome
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file infrasonar_selenium-1.0.2.tar.gz.
File metadata
- Download URL: infrasonar_selenium-1.0.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2981208ab39da054328638948a127916d4481d86e75e68979239d9aa379b5c7
|
|
| MD5 |
93ba713fd526fe431a4da652c555a7cc
|
|
| BLAKE2b-256 |
8a256bb7d6b32629d76f3c34fd78af19c6c9cb84075b20449f267d6ad34c4024
|