Skip to main content
Travis CI Build Status Coverage Status PyPI version License

PySelenium

A Python package that uses Selenium to enable for automating tests for web applications.

Setup instructions

Usage

After successfully going through the setup instructions, you can start programming your tests like so:

from pyselenium.test_metadata import Test
from pyselenium.test_steps import *
from pyselenium.test_runner import *

test = Test('My test')
test.add_step(Navigate('http://www.google.com'))
test.add_step(TypeText(css_path='#lst-ib', hint='Google search bar', text='Automating a Google search'))
test.add_step(SendEnter())
test_runner = TestRunner(test)
test_result = test_runner.run_test()

print(test_result)

Getting the CSS path from elements

Finding the CSS path from elements is failry easy with Google Chrome. All you need to do is right-click the element, and hit “Inspect” to bring up the developer tools console:

Inspect

With the developer tools console opened, right-click the element in it and choose “Copy Selector”:

Selector

The CSS path of the selected element should already be in your clipboard after doing this.

Sample test

You can find a sample test in pyselenium/sample_test.py

List of available test steps

These are the test steps currently available to be used:

  • Navigate

    • Navigates to a specified URL.

  • Click

    • Clicks on a given element on the web page. It may be any HTML element. Fails if the element can not be found on the web page.

  • AssertElementValue

    • Asserts that the element value (text) is equal to the specified one. Fails if the found value is different from the expected one.

  • AssertElementAttributeValue

    • Asserts that the value of a specific attribute of the HTML element is equal to the specified one. Fails if the found value is different from the expected one.

  • ClickIfFound

    • Clicks on a given element on the web page. It may be any HTML element. Does not fail if the element can not be found on the web page. If the element is not found, does nothing.

  • AssertElementNotPresent

    • Asserts that an element is not present on the web page. Fails if the element is found.

  • TypeText

    • Simulates the user typing text on a given element on the web page. Fails if the element is not found.

  • SelectDropDownItemByText

    • Selects an option on a dropdown element by comparing its text to a given value. Fails if the element is not found.

  • SetCheckbox

    • Sets a checkbox to true or false. Fails if the checkbox is not found.

  • SwitchFrame

    • Switches the context to a given iFrame on the page. Fails if the iFrame is not found. After running this step, one should call the SwitchToDefaultContent right after running the needed steps on the selected iFrame to ensure that the context is switched back to the default content of the page.

  • SwitchToDefaultContent

    • Switches the context to the default content of the web page. Should always be called after switching the context to another iFrame and running the needed steps on that iFrame.

  • SendEnter

    • Sends an ENTER key to the webpage. It’s the same as if the user simply hit the return button on the keyboard. This step does not have any context information as to there the focus is on the page, so should only be used when necessary.

Metadata

Release files for PySelenium 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PySelenium 1.0.2
File Size Uploaded
PySelenium-1.0.2.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PySelenium 1.0.2
File Interpreter ABI Platform
PySelenium-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / PySelenium-1.0.2.tar.gz

Download URL PySelenium-1.0.2.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
448d3f8bbd16af411164c3dcd2a8e52410256a5e71eb4b5f3b3502af23130236
BLAKE2b-256 checksum
How to use checksums
b56e2d4e7e2d4544cec9ffafa0c0e1643622c1570590e1b2c97e7842d16a0396
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / PySelenium-1.0.2-py3-none-any.whl

Download URL PySelenium-1.0.2-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f6d1a1a731ade1eb1c65b0c259145b848499abadb8bf8389aedbef33c08ed17
BLAKE2b-256 checksum
How to use checksums
d72e5d7db744c667f4bb11ac2e59acd7520cc15316d1b3e826f46c2c73f38874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page