Giter Site home page Giter Site logo

wd.py's Introduction

Macaca Python Client

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

wd.py's People

Contributors

ziczhu avatar xudafeng avatar centy720 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.