Skip to main content

Library for building InfraSonar Selenium tests

Project description

CI Release Version

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.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: infrasonar_selenium-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2b8dc0b4d17c8eba9b8961d36b72823db910e0b69fea7f2352cbabcbb0eaaa8c
MD5 0721107a6a5790c51ce4bd9a178ac76c
BLAKE2b-256 1f4787fe26e1d7aabf8d8ea3c744a983cdc8f24858b22565e7e05812b531f066

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