https://github.com/macacajs/wd.py
Python Client binding for Macaca
https://github.com/macacajs/wd.py
macaca python webdriver
Last synced: about 1 year ago
JSON representation
Python Client binding for Macaca
- Host: GitHub
- URL: https://github.com/macacajs/wd.py
- Owner: macacajs
- License: mit
- Created: 2016-08-09T06:27:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T17:13:30.000Z (about 5 years ago)
- Last Synced: 2025-03-28T23:21:40.254Z (about 1 year ago)
- Topics: macaca, python, webdriver
- Language: Python
- Homepage: https://macacajs.github.io/wd.py/
- Size: 372 KB
- Stars: 33
- Watchers: 15
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE.rst
Awesome Lists containing this project
README
Macaca Python Client
====================
.. image:: https://img.shields.io/coveralls/macacajs/wd.py/master.svg?style=flat-square
:target: https://coveralls.io/github/macacajs/wd.py
.. image:: https://img.shields.io/travis/macacajs/wd.py/master.svg?style=flat-square
:target: https://travis-ci.org/macacajs/wd.py
.. image:: https://img.shields.io/pypi/v/wd.svg?style=flat-square
:target: https://pypi.python.org/pypi/wd
.. image:: https://img.shields.io/pypi/pyversions/wd.svg?style=flat-square
:target: https://pypi.python.org/pypi/wd/
.. image:: https://img.shields.io/pypi/dd/wd.svg?style=flat-square
:target: https://pypi.python.org/pypi/wd/
Intro
-----
WD.py is a Python WebDriver client implemented most of the APIs in the `WebDriver Protocol `_.
It was originally designed for `Macaca /macacajs.github.io>`_ (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. /macacajs.github.io/wd.py/>`_
Sample
------
`WD.py’s sample. /github.com/macaca-sample/macaca-test-sample-python/>`_
Examples
--------
.. code-block:: python
>>> 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 <./CONTRIBUTING.rst>`_
License
-------
`MIT `_