Skip to main content

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 localhost with your appliance server address.

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

infrasonar_selenium-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file infrasonar_selenium-1.0.0.tar.gz.

File metadata

  • Download URL: infrasonar_selenium-1.0.0.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

Hashes for infrasonar_selenium-1.0.0.tar.gz
Algorithm Hash digest
SHA256 862b1333a683a94eabb920f6cfd5f46bc0019c90d7610e629fe133f4566a8fc1
MD5 99f12f1f49ae85726de353bb4dc2ad31
BLAKE2b-256 ec6e599893213bcc1435a0ff1c26d8f15f770bd9e219707d12a27f86f01bbca5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page