Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.
/ shale-python Public archive

A Python client for Shale, the Selenium hub replacement.

License

Notifications You must be signed in to change notification settings

thesis/shale-python

Repository files navigation

shale-python

A Python client for Shale, the Selenium hub replacement.

Examples

Get a client

>>> import shale
>>> client = shale.default_client
>>> # or, use a custom client
>>> client = shale.Client('http://my-shale-host:5000')

List all running webdrivers.

>>> client.running_browsers()
({u'browser_name': u'phantomjs',
  u'node': u'http://localhost:5555/wd/hub',
  u'id': u'31027408-3e45-4d27-9770-ba1a26953dfc',
  u'reserved': True,
  u'tags': [u'target', u'linux']},)

Reserve a webdriver.

>>> browser = client.reserve_browser('31027408-3e45-4d27-9770-ba1a26953dfc')
<shale.client.ClientResumableRemote at 0x1d92fd0>

... and release it.

>>> browser.release()

There's a handy context manager for reserving & releasing webdrivers.

>>> with client.browser(browser_name='chrome', tags=['logged-in']) as browser:
...     # do yo thang
...     pass
...
>>> with client.browser(session_id='123...') as browser:
...     # do yo thang with a particular browser session
...     pass

You can also force create a new remote webdriver.

>>> browser = client.create_browser()

Running the tests

pip install tox
tox

About

A Python client for Shale, the Selenium hub replacement.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published