Skip to main content

A human readable wrapper class for selenium

Project description

Module selenium_library

Sub-modules

  • selenium_library.base

Classes

Base(browser='chrome', headless=True, window_width=1920, window_height=1080) : Base selenium

Example:
    from selenium_library import Base

    session = Base(headless=False)
    session.open('https://www.google.de')
    input = session.element('[name="q"]')
    session.click(input)
    session.send_keys(input, 'pipi')

Init session vars

Args:
browser (str): Browser name
headlesss (boolean): Hide browser
window_width (int): Window width
window_height (int): Window height

### Methods

`clear_keys(self, selector_or_element)`
:   Clear keys from element

    Args:
        selector_or_element [str, WebElement]

`click(self, selector_or_element)`
:   Try to click on an element

    Args:
        selector_or_element [str, WebElement]

`close(self)`
:   Close the current session

`element(self, selector)`
:   Try to find an element in dom

    Returns [None]: Element or None

`elements(self, selector)`
:   Try to find every element in dom
        If there is no element it returns None

    Args:
        selector (str): DOM selector


    Returns [None, list]: List of elements or None

`get_url(self)`
:   Get the current url from the session

    Returns (str): Current url

`launch_browser(self)`
:   Launch browser and create a session

`open(self, url)`
:   Open a new url in the session

`send_keys(self, selector_or_element, keys)`
:   Send keys to an element

    Args:
        selector_or_element [str, WebElement]
        keys (str): Keys to send

`wait(self, time=1, is_random=False, min=1, max=10)`
:   Wait a specific time or random

    Args:
        time (int): Time to stop script
        is_random (boolean): Waits a random time if true
        min (int): Minium time to wait if random
        max (int): Max time to wait if random

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for selenium-library, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size selenium_library-0.0.3-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size selenium_library-0.0.3.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page