Skip to main content

Macaca Python Client

Project description

https://img.shields.io/coveralls/macacajs/wd.py/master.svg?style=flat-square https://img.shields.io/travis/macacajs/wd.py/master.svg?style=flat-square https://img.shields.io/pypi/v/wd.svg?style=flat-square https://img.shields.io/pypi/pyversions/wd.svg?style=flat-square https://img.shields.io/pypi/dd/wd.svg?style=flat-square

Intro

WD.py is a Python WebDriver client implemented most of the APIs in the WebDriver Protocol. It was originally designed for Macaca (A Node.js powered WebDriver server), but also available for any other implementation of WebDriver server such as Selenium, Appium and etc.

Homepage

WD.py’s documentation.

Sample

WD.py’s sample.

Examples

>>> from macaca import WebDriver, WebElement

# Configure the desired capabilities.
>>> desired_caps = {
    'autoAcceptAlerts': True,
    'browserName': 'electron',
    'platformName': 'desktop'
}

>>> driver = WebDriver(desired_caps)

# Start the WebDriver session
>>> driver.init()

# Support fluent API
>>> driver.set_window_size(1280, 800).get("https://www.google.com")

# Get WebElement instance through element_by_* APIs.
>>> web_element = driver.element_by_id("lst-ib")
>>> print(type(web_element))
macaca.webelement.WebElement

# WebElement include methods such as send_keys, click, get_attribute and etc.
>>> web_element.send_keys("macaca")
>>> web_element = driver.element_by_name("btnK")
>>> web_element.click()

# WebDriver also has some properties like source, title and current_url.
>>> html = driver.source
>>> print('Does Macaca exist: ', 'macaca' in html)
Does Macaca exist: True
>>> title = driver.title
>>> print(title)
macaca - Google Search

Changelog

Details changes for each release are documented in the HISTORY.rst.

Contributing

See CONTRIBUTING.rst

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

wd-1.0.1-py2.py3-none-any.whl (23.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wd-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wd-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8b501f757d732d26d5a85dff044cd71f9013e13edbed669ed888cffabe44f64a
MD5 41a66da10fccc513a03dee6365db80fd
BLAKE2b-256 ee09d31747c21bd2c6b394e18b34c07afd43b5933f1e7c92830030b582201257

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