Skip to main content

Ready-to-run Selenium.

Project description

AutoSelenium: Ready-to-run Selenium

This Python 3 library solves most of the problems usually found when using Selenium.

Installing

  1. Install a version of Firefox compatible with geckodriver 0.26.0 (see this compatibility table)
  2. Install this library via pip using: pip install autoselenium

Usage

>>> 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:

  • headless: A boolean, False by default. When true, the Firefox interface won't be shown.
  • detect_driver_path: A boolean, True by default. When true, geckodriver will be automatically located and downloaded.
  • disable_images: A boolean, True by default. When true, images won't be loaded to improve the performance.
  • disable_flash: A boolean, True by default. When true, Flash will be disabled.
  • open_links_same_tab: A boolean, False by default. When true, even new tab links will be opened in the same tab.
  • timeout: An integer, 15 by default. Page load timeout.
  • version: A string, 0.26.0 by default. 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.
  • Any of the Selenium Firefox parameters.

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.

Features

  • Full Selenium compatibility: the automatic drivers inherit the Selenium driver, so every available functionality is preserved.
  • Geckodriver management: a 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.

Contributions ✨

You can take any of the pending enhancements, work on it and open a pull request.

Changes

Find here the changes on this library (from recent to older) and the features of each version. We follow Semantic Versioning 2.0.0 guidelines to improve the dependency management automation.

v0.1.0

Relased on Oct 28, 2019.

  • More helpful exceptions (including install exceptions).
  • Friendlier readme.
  • Bugfix: now compatible with any Python 3 library.

v0.0.1

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

Uploaded Source

Built Distribution

autoselenium-0.1.7-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autoselenium-0.1.7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.11.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for autoselenium-0.1.7.tar.gz
Algorithm Hash digest
SHA256 9efccc3395b94c273ff4343d1a8fd1af8c11e0d2b0f35b499f087baab80813c8
MD5 ee98bf0f847a0ea5f3aed16e9137bd7a
BLAKE2b-256 23c08e020a23ac7f3b27a860784d090377c73aada56055a48b679e8271abb44c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autoselenium-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.11.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for autoselenium-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 866102f00a747672ec4da31d23196f4db9b302f53471cc3195ec8807f39b9f0a
MD5 9170ac02a8a9f03ff544bc29c20658a0
BLAKE2b-256 c2e9262e50208b50a19b842e5371679b99c1ed8e14f9fa6dc52c3e4cfc8ecf7d

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