Skip to main content

selenium interface

Project description


The purpose of this package is to simplify the use of selenium.




$ pip install anna-lib


from anna_lib.selenium import driver, events, assertions

result = []
firefox = driver.create(driver='firefox', headless=True)

firefox.get(''), target='a[href=""]')

result.append(assertions.current_url_is(firefox, ''))


Use this module to create a webdriver based on a set of options:

param type required   values default value
driver string  yes 'firefox' or 'chrome' for now 'firefox'
headless bool   no True or False False
resolution tuple  no  (width, height) (1920, 1080)


Use this module to interact with pages. Each event takes a driver, a target & a timeout which defaults to 16 seconds, with the exception being send_keys which also requires a value. The target is treated as a css selector unless it starts with '$xpath', in which case it is of course treated as an xpath selector.

from anna_lib.selenium import events, driver
firefox = driver.create('firefox', headless=True), target='#search')
events.send_keys(driver=firefox, target='#search', value='search terms')
events.submit(driver=firefox, target='#search')
events.hover(driver=firefox, target='$xpath//div.result/a')
events.scroll_to(driver=firefox, target='#thing')
events.switch_to(driver=firefox, target='iframe')


Use this module to check the state of a page, be it by the url or by the page's elements. Each assertion takes a driver, some input & a timeout parameter which defaults to 16 seconds.

from anna_lib.selenium import assertions, driver
firefox = driver.create('firefox', headless=True)

	assertions.url_equals(driver=firefox, expected='about:blank')
	assertions.in_url(driver=firefox, part='blank')
	assertions.element_exists(driver=firefox, target='body')
except ValueError as e:
except TypeError as e:

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 anna-lib, version 0.0.13
Filename, size File type Python version Upload date Hashes
Filename, size anna_lib-0.0.13.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View
Filename, size anna_lib-0.0.13-py3-none-any.whl (6.8 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page