2016-05-04 19:54:04 +03:00
|
|
|
|
# geckodriver [![Build Status](https://travis-ci.org/mozilla/geckodriver.svg?branch=master)](https://travis-ci.org/mozilla/geckodriver)
|
2016-01-06 20:43:06 +03:00
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
Proxy for using W3C WebDriver-compatible clients
|
|
|
|
|
to interact with Gecko-based browsers.
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
This program provides the HTTP API described by
|
|
|
|
|
the [WebDriver protocol](http://w3c.github.io/webdriver/webdriver-spec.html#protocol)
|
|
|
|
|
to communicate with Gecko browsers, such as Firefox.
|
|
|
|
|
It translates calls into
|
2016-12-13 19:24:35 +03:00
|
|
|
|
the [Marionette automation protocol](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette)
|
2016-05-04 19:54:04 +03:00
|
|
|
|
by acting as a proxy between the local- and remote ends.
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-06-24 13:41:35 +03:00
|
|
|
|
You can consult the [change log](https://github.com/mozilla/geckodriver/blob/master/CHANGES.md)
|
|
|
|
|
for a record of all notable changes to the program.
|
2016-12-13 19:24:06 +03:00
|
|
|
|
[Releases](https://github.com/mozilla/geckodriver/releases)
|
|
|
|
|
are made available on GitHub
|
|
|
|
|
on [supported platforms](#supported-firefoxen).
|
2016-06-24 13:41:35 +03:00
|
|
|
|
|
2016-06-30 13:26:34 +03:00
|
|
|
|
## Supported Firefoxen
|
|
|
|
|
|
|
|
|
|
Marionette and geckodriver are not yet feature complete.
|
2016-12-13 19:24:52 +03:00
|
|
|
|
This means that they do not yet offer full conformance
|
2016-06-30 13:26:34 +03:00
|
|
|
|
with the [WebDriver standard](https://w3c.github.io/webdriver/webdriver-spec.html)
|
|
|
|
|
or complete compatibility with [Selenium](http://www.seleniumhq.org/).
|
|
|
|
|
You can track the [implementation status](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status)
|
2016-12-13 19:25:14 +03:00
|
|
|
|
of the latest [Firefox Nightly](http://whattrainisitnow.com/) on
|
|
|
|
|
[MDN](https://developer.mozilla.org/).
|
2016-08-02 19:23:55 +03:00
|
|
|
|
We also keep track of known
|
2016-06-30 13:26:34 +03:00
|
|
|
|
[Marionette](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Amarionette),
|
|
|
|
|
[Selenium](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Aselenium),
|
|
|
|
|
and [specification](https://github.com/mozilla/geckodriver/issues?q=is%3Aissue+is%3Aopen+label%3Aspec)
|
2016-12-13 19:25:14 +03:00
|
|
|
|
problems in our
|
|
|
|
|
[issue tracker](https://github.com/mozilla/geckodriver/issues).
|
2016-06-30 13:26:34 +03:00
|
|
|
|
|
2016-12-13 19:23:39 +03:00
|
|
|
|
Support is best in Firefox 48 and onwards,
|
|
|
|
|
although generally the more recent the Firefox version,
|
|
|
|
|
the better the experience as they have more bug fixes and features.
|
|
|
|
|
We strongly advise using the [latest Firefox Nightly](https://nightly.mozilla.org/) with geckodriver,
|
|
|
|
|
and want to make it clear that Firefox 47 and earlier is explicitly not supported.
|
|
|
|
|
Since Windows XP support in Firefox will be dropped with Firefox 53,
|
|
|
|
|
we do not support this platform.
|
2016-06-30 13:26:34 +03:00
|
|
|
|
|
2016-12-08 22:43:49 +03:00
|
|
|
|
## WebDriver capabilities
|
|
|
|
|
|
|
|
|
|
geckodriver supports a number of
|
|
|
|
|
[WebDriver capabilities](https://w3c.github.io/webdriver/webdriver-spec.html#capabilities):
|
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name
|
|
|
|
|
<th>Type
|
|
|
|
|
<th>Description
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>proxy</code>
|
|
|
|
|
<td><a href=#proxy-object><code>proxy</code></a> object
|
|
|
|
|
<td>Sets browser proxy settings.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>acceptInsecureCerts</code>
|
|
|
|
|
<td>boolean
|
|
|
|
|
<td>Boolean initially set to false,
|
|
|
|
|
indicating the session will not implicitly trust untrusted
|
|
|
|
|
or self-signed TLS certificates on navigation.
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
### `proxy` object
|
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name
|
|
|
|
|
<th>Type
|
|
|
|
|
<th>Description
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>proxyType</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Indicates the type of proxy configuration.
|
|
|
|
|
This value must be one of
|
|
|
|
|
<code>pac</code>,
|
|
|
|
|
<code>noproxy</code>,
|
|
|
|
|
<code>autodetect</code>,
|
|
|
|
|
<code>system</code>,
|
|
|
|
|
or <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>proxyAutoconfigUrl</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the URL for a proxy auto-config file.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>pac</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>ftpProxy</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the proxy hostname for FTP traffic.
|
|
|
|
|
Should only be set then the <code>proxyType</code>
|
|
|
|
|
is set to <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>ftpProxyPort</code>
|
|
|
|
|
<td>number
|
|
|
|
|
<td>Defines the proxy port for FTP traffic.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>httpProxy</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the hostname for HTTP traffic.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>httpProxyPort</code>
|
|
|
|
|
<td>number
|
|
|
|
|
<td>Defines the proxy port for HTTP traffic.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>sslProxy</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the proxy hostname
|
|
|
|
|
for encrypted TLS traffic.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>sslProxyPort</code>
|
|
|
|
|
<td>number
|
|
|
|
|
<td>Defines the proxy port for SSL traffic.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>socksProxy</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the proxy hostname for a SOCKS proxy.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>socksProxyPort</code>
|
|
|
|
|
<td>number
|
|
|
|
|
<td>Defines the proxy port for a SOCKS proxy.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>socksVersion</code>
|
|
|
|
|
<td>number
|
|
|
|
|
<td>Defines the SOCKS proxy version.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>socksUsername</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the username used
|
|
|
|
|
when authenticating with a SOCKS proxy.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>socksPassword</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Defines the password used
|
|
|
|
|
when authenticating with a SOCKS proxy.
|
|
|
|
|
This property should only be set
|
|
|
|
|
when <code>proxyType</code> is <code>manual</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
2016-08-04 18:46:38 +03:00
|
|
|
|
## Firefox capabilities
|
|
|
|
|
|
2016-12-08 06:03:36 +03:00
|
|
|
|
geckodriver also supports a capability named `moz:firefoxOptions`
|
2016-09-30 16:02:42 +03:00
|
|
|
|
which takes Firefox-specific options.
|
|
|
|
|
This must be a dictionary
|
|
|
|
|
and may contain any of the following fields:
|
2016-07-21 16:58:52 +03:00
|
|
|
|
|
|
|
|
|
<table>
|
2016-09-30 16:02:42 +03:00
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name
|
|
|
|
|
<th>Type
|
|
|
|
|
<th>Description
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>binary</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Absolute path of the Firefox binary,
|
|
|
|
|
e.g. <code>/usr/bin/firefox</code>
|
|
|
|
|
or <code>/Applications/Firefox.app/Contents/MacOS/firefox</code>,
|
|
|
|
|
to select which custom browser binary to use.
|
|
|
|
|
If left undefined geckodriver will attempt
|
|
|
|
|
to deduce the default location of Firefox
|
|
|
|
|
on the current system.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>args</code>
|
2016-10-05 19:07:01 +03:00
|
|
|
|
<td>array of strings
|
2016-09-30 16:02:42 +03:00
|
|
|
|
<td>Command line arguments to pass to the Firefox binary.
|
|
|
|
|
These must include the leading <code>--</code> where required
|
|
|
|
|
e.g. <code>["--devtools"]</code>.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>profile</code>
|
|
|
|
|
<td>string
|
|
|
|
|
<td>Base64-encoded zip of a profile directory
|
|
|
|
|
to use as the profile for the Firefox instance.
|
|
|
|
|
This may be used to e.g. install extensions
|
|
|
|
|
or custom certificates.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>log</code>
|
2016-10-05 19:05:40 +03:00
|
|
|
|
<td><a href=#log-object><code>log</code></a> object
|
2016-09-30 16:02:42 +03:00
|
|
|
|
<td>Logging options for Gecko.
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>prefs</code>
|
2016-10-05 19:05:40 +03:00
|
|
|
|
<td><a href=#prefs-object><code>prefs</code></a> object
|
2016-09-30 16:02:42 +03:00
|
|
|
|
<td>Map of preference name to preference value, which can be a
|
|
|
|
|
string, a boolean or an integer.
|
|
|
|
|
</tr>
|
2016-07-21 16:58:52 +03:00
|
|
|
|
</table>
|
2016-08-04 18:46:38 +03:00
|
|
|
|
|
2016-09-30 16:02:42 +03:00
|
|
|
|
### `log` object
|
2016-09-07 18:27:59 +03:00
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name
|
|
|
|
|
<th>Type
|
|
|
|
|
<th>Description
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><code>level</code>
|
2016-09-30 16:02:42 +03:00
|
|
|
|
<td>string
|
2016-09-07 18:27:59 +03:00
|
|
|
|
<td>Set the level of verbosity in Gecko.
|
|
|
|
|
Available levels are <code>trace</code>,
|
|
|
|
|
<code>debug</code>, <code>config</code>,
|
|
|
|
|
<code>info</code>, <code>warn</code>,
|
|
|
|
|
<code>error</code>, and <code>fatal</code>.
|
2016-11-21 16:55:35 +03:00
|
|
|
|
If left undefined the default is <code>info</code>.
|
2016-09-30 16:02:42 +03:00
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
### `prefs` object
|
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name
|
|
|
|
|
<th>Type
|
|
|
|
|
<th>Description
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td><var>preference name</var>
|
|
|
|
|
<td>string, number, boolean
|
|
|
|
|
<td>One entry per preference to override.
|
2016-09-07 18:27:59 +03:00
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
2016-12-08 06:03:36 +03:00
|
|
|
|
## Capabilities examples
|
|
|
|
|
|
|
|
|
|
To select a specific Firefox binary
|
|
|
|
|
and run it with a specific command-line flag,
|
|
|
|
|
set a preference,
|
|
|
|
|
and enable verbose logging:
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
{
|
|
|
|
|
"moz:firefoxOptions": {
|
|
|
|
|
"binary": "/usr/local/firefox/bin/firefox",
|
|
|
|
|
"args": ["--no-remote"],
|
|
|
|
|
"prefs": {
|
|
|
|
|
"dom.ipc.processCount": 8
|
|
|
|
|
},
|
|
|
|
|
"log": {
|
|
|
|
|
"level": "trace"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
## Building
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
geckodriver is written in [Rust](https://www.rust-lang.org/)
|
2016-08-22 19:15:49 +03:00
|
|
|
|
and you need the [Rust toolchain](https://rustup.rs/) to compile it.
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-06-22 16:12:23 +03:00
|
|
|
|
To build the project for release,
|
|
|
|
|
ensure you do a compilation with optimisations:
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-06-22 16:12:23 +03:00
|
|
|
|
% cargo build --release
|
2016-01-06 20:43:06 +03:00
|
|
|
|
|
2016-06-22 16:12:23 +03:00
|
|
|
|
Or if you want a non-optimised binary for debugging:
|
2016-05-04 19:54:04 +03:00
|
|
|
|
|
2016-06-22 16:12:23 +03:00
|
|
|
|
% cargo build
|
2016-07-21 16:58:52 +03:00
|
|
|
|
|
2015-08-12 06:36:50 +03:00
|
|
|
|
## Usage
|
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
Usage steps are [documented on MDN](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver),
|
|
|
|
|
but the gist of it is this:
|
2016-01-06 20:43:06 +03:00
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
% geckodriver -b /usr/bin/firefox
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
Or if you’re on Mac:
|
2015-08-12 06:36:50 +03:00
|
|
|
|
|
2016-05-04 19:54:04 +03:00
|
|
|
|
% geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
|