Skip to main content

Ready-to-run Selenium.

Project description

AutoSelenium: Selenium without any hassle

This Python 3 library solves most of the tasks that are usually related to use Selenium in a project. The main features of this library are:

  • Full Selenium compatibility: the automatic drivers inherit the Selenium driver, so every available functionality is preserved.
  • Geckodriver management: the latest valid Geckodriver is automatically downloaded, unzipped and stored according to the selenium version and operative system.
  • Updated defaults: some of the most common driver configurations are automatically set, such as disabling Flash, ignoring the txt log file or closing the driver when the program ends. All of them can be edited via construction params.
  • Rendering analysis: the rendering features such as computed style, width, height or XPath are added to the page source when using driver.get_with_render instead of driver.get.

Some features to be expected in the future are:

  • Support for Chrome and Safari drivers.
  • Parameters to set the window width and height.
  • Parameter to set phone mode.

How to install

You can install this library via pip using: pip install autoselenium

Usage example

>>> from autoselenium import Firefox
>>>
>>> driver = Firefox(headless=True)
>>>
>>> driver.get('https://juancroldan.com')
>>> driver.find_element_by_tag_name('div').get_attribute('outerHTML')
'<div id="mw-page-base" class="noprint"></div>'
>>>
>>> driver.get_with_render('https://juancroldan.com')
>>> driver.find_element_by_tag_name('div').get_attribute('outerHTML')
'<div id="mw-page-base" class="noprint"\
	data-xpath="/html[1]/body[1]/div[1]"\
	data-computed-style="align-content:normal;align-items:normal;...;z-index:auto"\
	data-width="1356" data-height="80"\
	data-width-rel="1" data-height-rel="0.11527377521613832"></div>'

This library only have one class: Firefox, a child of selenium.drivers.Firefox with extended construction parameters:

Firefox(headless=False, detect_driver_path=True, disable_images=True, disable_flash=True, open_links_same_tab=False, timeout=15, version='0.26.0', options=None, *args, **kwargs)

  • headless: bool: When true, the Firefox interface won't be shown.
  • detect_driver_path: bool: When true, geckodriver will be automatically located and downloaded.
  • disable_images: bool: When true, images won't be loaded to improve the performance.
  • disable_flash: bool: When true, Flash will be disabled.
  • open_links_same_tab: bool: When true, even new tab links will be opened in the same tab.
  • timeout: int: Page load timeout.
  • version: str: If detect_driver_path is set, this geckodriver version will be downloaded. When a new geckodriver is relased, it is tested with the latest Selenium version to use the most recent compatible version.

It also implements one extra function, driver.get_with_render(url, render_selector='body'), which works the same way as driver.get(url), processing the nodes selected by render_selector with a few rendering operations:

  • Nodes without rendering are removed.
  • For every node and child, a few data- properties are added:
    • data-xpath: XPath of the node.
    • data-computed-style: Computed style of the nodes, using the same notation of the style element attribute.
    • data-width: Width of the node.
    • data-height: Height of the node.
    • data-width-rel: Width of the node relative to the page width.
    • data-height-rel: Height of the node relative to the page height.

Changes

v0.0.

Released on Oct 10, 2019.

  • Initial package upload.
  • Removed table-specific features.

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

autoselenium-0.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

autoselenium-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file autoselenium-0.0.1.tar.gz.

File metadata

  • Download URL: autoselenium-0.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for autoselenium-0.0.1.tar.gz
Algorithm Hash digest
SHA256 202e906e9a5c9ddcf1ac0500afbfba657c52139a852440d4eafd1f57e418aea1
MD5 c5206b916ae59ebfb76bb0c1e243836d
BLAKE2b-256 b6f80c952c2c648eee0a9848017172623c81d7dca1927d5e16a08bc3fc5b7722

See more details on using hashes here.

File details

Details for the file autoselenium-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: autoselenium-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for autoselenium-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8bd68ce7bd8fe558db6239a5229264d71056ab6de26d1c843aff5078011556a7
MD5 451ee565c8064bbe7ed90278adb2bfac
BLAKE2b-256 4f151e80d9b84343dcf6287d2075bf69f8a06daf76ee39daa4e098f8dce44e54

See more details on using hashes here.

Supported by

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