Files
firefox/testing/web-platform/tests/tools/webdriver
Ali Juma bb9780cb94 Bug 1567017 [wpt PR 17892] - Add support for running tests with Chrome for iOS, a=testonly
Automatic update from web-platform-tests
Add support for running tests with Chrome for iOS (#17892)

* Add support for running tests with Chrome for iOS

This adds Chrome for iOS as a supported browser. Because of iOS-specific
constraints, running tests with Chrome on iOS requires a local build
of Chrome. Specifically:
1) Checkout chromium, and build the targets ios_cwt_chromedriver_tests and
   ios_cwt_chromedriver_tests_module.
2) Pass <CHROMIUM_SRC_DIR>/ios/chrome/test/wpt/tools/run_cwt_chromedriver.py
   as the --webdriver-binary argument to 'wpt run'

The default build directory, iOS simulator device type, and iOS version are
specified inside run_cwt_chromedriver.py, but can be overridden by passing
--webdriver-arg arguments to 'wpt run'. For example, to use an iPhone X
simulator instead of the default iPhone 8 simulator, pass the argument
--webdriver-arg='--device=iPhone X'.
--

wpt-commits: c88dfdfe443e497c28b98936228e94cc45b8cdbe
wpt-pr: 17892
2019-07-24 13:35:31 +01:00
..
…

WebDriver client for Python

This package provides Python bindings that conform to the W3C WebDriver standard, which specifies a remote control protocol for web browsers.

These bindings are written with determining implementation compliance to the specification in mind, so that different remote end drivers can determine whether they meet the recognised standard. The client is used for the WebDriver specification tests in the Web Platform Tests.

Installation

To install the package individually in your virtualenv or system-wide:

% python setup.py install

Since this package does not have any external dependencies, you can also use the client directly from the checkout directory, which is useful if you want to contribute patches back:

% cd /path/to/wdclient
% python
Python 2.7.12+ (default, Aug  4 2016, 20:04:34) 
[GCC 6.1.1 20160724] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import webdriver
>>> 

If you are writing WebDriver specification tests for WPT, there is no need to install the client manually as it is included in the tools/webdriver directory.

Usage

You can use the built-in context manager to manage the lifetime of the session. The session is started implicitly at the first call to a command if it has not already been started, and will implicitly be ended when exiting the context:

import webdriver

with webdriver.Session("127.0.0.1", 4444) as session:
    session.url = "https://mozilla.org"
    print "The current URL is %s" % session.url

The following is functionally equivalent to the above, but giving you manual control of the session:

import webdriver

session = webdriver.Session("127.0.0.1", 4444)
session.start()

session.url = "https://mozilla.org"
print "The current URL is %s" % session.url

session.end()

Dependencies

This client has the benefit of only using standard library dependencies. No external PyPI dependencies are needed.