gecko-dev/testing/marionette
Wes Kocher 75e9f7dbef Backed out 10 changesets (bug 1391691) for wpt failures a=backout
Backed out changeset 666ac679317e (bug 1391691)
Backed out changeset 46f82e1e2cde (bug 1391691)
Backed out changeset 1fd98ace1473 (bug 1391691)
Backed out changeset 5bddbd90ec7c (bug 1391691)
Backed out changeset 4653134d01ef (bug 1391691)
Backed out changeset fd88b612ac2e (bug 1391691)
Backed out changeset 6306abc0b5e9 (bug 1391691)
Backed out changeset 649b0e761c87 (bug 1391691)
Backed out changeset 6c48daaad075 (bug 1391691)
Backed out changeset 17aeed1f6454 (bug 1391691)

MozReview-Commit-ID: 6Cw1QibNQKM

--HG--
extra : rebase_source : 0197f824719f11e113595dd9a4a86b2c8d1fd8fe
2017-08-21 09:19:10 -07:00
..
chrome
client Bug 1388424 - Fix flake8 issue a=me 2017-08-11 13:04:38 -07:00
components Bug 1391952 - Disable camel case lint for input and output. r=automatedtester 2017-08-19 14:21:43 +01:00
doc No bug: Generate Marionette API docs. r=me 2017-08-15 19:56:04 +01:00
harness Backed out 10 changesets (bug 1391691) for wpt failures a=backout 2017-08-21 09:19:10 -07:00
prefs Bug 1376128 - Expose unrecognised eslint globals; r=automatedtester 2017-06-28 11:04:14 -07:00
puppeteer Bug 1380278 - UpdateUtils.getLocale to Fetch API for async I/O. r=florian,whimboo 2017-07-12 10:34:23 -07:00
.eslintrc.js Bug 1391952 - Introduce camel case lint rule. r=automatedtester 2017-08-19 14:18:51 +01:00
.jsdoc.js Bug 1384517 - Provide jsdoc rules for testing/marionette; r=automatedtester 2017-07-26 13:09:15 +01:00
accessibility.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
action.js Bug 1388082 - Switch to async/await in action module. r=automatedtester 2017-08-07 18:56:08 +01:00
addon.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
assert.js Bug 1387559 - Drop session_id fallback for WebDriver:NewSession. r=automatedtester 2017-08-05 17:35:54 +01:00
atom.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
browser.js Backed out 10 changesets (bug 1391691) for wpt failures a=backout 2017-08-21 09:19:10 -07:00
capture.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
cert.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
cookie.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
driver.js Backed out 10 changesets (bug 1391691) for wpt failures a=backout 2017-08-21 09:19:10 -07:00
element.js Bug 1387644 - Return NoSuchElementError when element is not found r=ato 2017-08-05 00:50:46 +01:00
error.js Bug 1385547 - Lint testing/marionette. r=automatedtester 2017-07-31 16:01:12 +01:00
evaluate.js Bug 1374620 - Enabled the ESLint dot-notation rule across mozilla-central r=standard8 2017-07-25 23:45:41 +05:30
event.js Bug 1370403 - Synthesize contextmenu MouseEvent when performing webdriver actions; r=maja_zf 2017-08-09 07:51:18 -04:00
frame.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
interaction.js Bug 1388082 - Switch to async/await in interaction module. r=automatedtester 2017-08-07 18:56:29 +01:00
jar.mn Bug 1363428 - Add reftest-specific endpoints to Marionette, r=ato 2017-06-24 12:03:11 +01:00
l10n.js Bug 1385547 - Lint testing/marionette. r=automatedtester 2017-07-31 16:01:12 +01:00
legacyaction.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
listener.js Bug 1391952 - Lint testing/marionette. r=automatedtester 2017-08-19 14:22:17 +01:00
mach_commands.py Bug 1390595 - Exit with jsdoc return code from "mach marionette doc". r=whimboo 2017-08-15 20:00:42 +01:00
mach_test_package_commands.py
message.js Bug 1388082 - Remove unused import. r=automatedtester 2017-08-07 19:01:20 +01:00
modal.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
moz.build
navigate.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
packets.js Bug 1385547 - Lint testing/marionette. r=automatedtester 2017-07-31 16:01:12 +01:00
proxy.js Bug 1388082 - Update proxy examples and docs. r=automatedtester 2017-08-07 18:57:11 +01:00
README.html Bug 1384517 - Render Marionette README as HTML; r=automatedtester 2017-07-26 13:08:17 +01:00
reftest.js Bug 1391952 - Lint testing/marionette. r=automatedtester 2017-08-19 14:22:17 +01:00
reftest.xul Bug 1363428 - Add reftest-specific endpoints to Marionette, r=ato 2017-06-24 12:03:11 +01:00
server.js Bug 1390486 - Add "dom.file.createInChild" preference to recommended prefs. r=ato 2017-08-15 17:47:15 +02:00
session.js Bug 1391016 - "proxyAutoconfigUrl" is required for proxyType "pac". r=automatedtester 2017-08-16 21:58:55 +02:00
stream-utils.js Bug 1385547 - Lint testing/marionette. r=automatedtester 2017-07-31 16:01:12 +01:00
test_action.js
test_assert.js Bug 1387559 - Drop session_id fallback for WebDriver:NewSession. r=automatedtester 2017-08-05 17:35:54 +01:00
test_cookie.js Bug 1371733 - Move cookie service to chrome space; r=whimboo 2017-06-12 18:05:22 +01:00
test_element.js
test_error.js Bug 1376128 - Lint testing/marionette; r=automatedtester 2017-06-29 16:40:24 -07:00
test_message.js
test_navigate.js Bug 1374672 - Don't wait for page load events for identical hash parameters. r=automatedtester 2017-07-07 17:34:27 +02:00
test_session.js Bug 1387092 - Add support for proxyType "direct". r=ato 2017-08-15 19:23:33 +02:00
test_wait.js Bug 1388082 - Use async/await in wait module xpcshell tests. r=automatedtester 2017-08-07 18:58:09 +01:00
transport.js Bug 1385547 - Lint testing/marionette. r=automatedtester 2017-07-31 16:01:12 +01:00
unit.ini Bug 1371733 - Move cookie service to chrome space; r=whimboo 2017-06-12 18:05:22 +01:00
wait.js Bug 1381876 - Introduce TimedPromise. r=automatedtester 2017-08-01 18:28:13 +01:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1>Marionette</h1>

<p>Marionette is the remote protocol that lets OOP programs
 communicate with, instrument, and control Gecko.


<h2>Description</h2>

<p>Marionette is an automation driver for Mozillas Gecko engine.
 It can remotely control either the UI
 or the internal JavaScript of the Gecko platform, such as Firefox.
 It can control both the chrome and the content document,
 giving a high level of control and ability to replicate user interaction.
 In addition to performing actions on the browser,
 Marionette can also read properties and attributes of the DOM.


<h2>Usage</h2>

<p>Marionette can be activated by passing the -marionette flag.
 To start Firefox with the remote protocol turned on:

<pre>
% firefox -marionette
…
1491228343089	Marionette	INFO	Listening on port 2828
</pre>

<p>This binds to a TCP socket, over which <a href=#clients>clients</a>
 can communicate with Marionette using the <a href=#protocol>protocol</a>.


<h2 id=protocol>Protocol</h2>

<p>Marionette provides an asynchronous,
 parallel pipelining user-facing interface.
 Message sequencing limits chances of payload race conditions
 and provides a uniform way in which payloads are serialised.

<p>Clients that deliver a blocking WebDriver interface
 are still expected to not send further command requests
 before the response from the last command has come back,
 but if they still happen to do so because of programming error,
 no harm will be done.
 This guards against <a href=https://bugzil.la/1207125>mixing up responses</a>.

<p>Schematic flow of messages:

<pre>
               client      server
                 |            |
      msgid=1    |----------->|
                 |  command   |
                 |            |
      msgid=2    |<-----------|
                 |  command   |
                 |            |
      msgid=2    |----------->|
                 |  response  |
                 |            |
      msgid=1    |<-----------|
                 |  response  |
                 |            |
</pre>

<p>The protocol consists of a <a href=#command>command</a> message
 and the corresponding <a href=#response>response</a> message.
 A <a href=#response>response</a> message must always be sent
 in reply to a <a href=#command>command</a> message.

<p>This means that the server implementation does not need to send
 the reply precisely in the order of the received commands:
 if it receives multiple messages, the server may even reply in random order.
 It is therefore strongly adviced that clients take this into account
 when implementing the client end of this wire protocol.

<p>This is required for pipelining messages.
 On the server side, some functions are fast, and some less so.
 If the server must reply in order, the slow functions delay the other replies
 even if its execution is already completed.


<h2 id=command>Command</h2>

<p>The request, or command message,
 is a four element JSON array as shown below,
 that may originate from either the client- or server remote ends:

<pre>[type, message ID, command, parameters]</pre>

<dl>
 <dt>type
 <dd><p>Must be 0 (integer).
  This indicates that the message
  is the <a href=#command>command</a> message.

 <dt>message ID
 <dd><p>A 32-bit unsigned integer.
  This number is used as sequencing number
  that uniquely identifies a pair of <a href=#command>command</a>
  and <a href=#response>response</a> messages.
  The other remote part will reply
  with a corresponding <a href=#response>response</a>
  with the same message ID.

 <dt>command
 <dd><p>A string identifying the RPC method or command to execute.

 <dt>parameters
 <dd><p>An arbitrary JSON serialisable object.
</dl>

<h2 id=response>Response</h2>

<p>The response message is also a four element array as shown below,
 and must always be sent after receiving a <a href=#command>command</a>:

<pre>[type, message ID, error, result]</pre>

<dl>
 <dt>type
 <dd><p>Must be 1 (integer).
  This indicates that the message is
  the <a href=#response>response</a> message.

 <dt>message ID
 <dd><p>A 32-bit unsigned integer.
  This corresponds to the <a href=#command>command</a> messages
  message ID.

 <dt>error
 <dd><p>If the command executed correctly, this field is null.
  If the error occurred on the server-side,
  then this field is an <a href=#error>error</a> object.

 <dt>result
 <dd><p>The result object associated with the <a href=#command>command</a>,
  if it executed correctly.
  If an error occurred on the server-side, this field is null.

  <p>The structure of the result entry can vary,
   but is documented individually for each command.
</dl>


<h3 id=error>Error object</h3>

<p>An error object is a serialisation of JavaScript error types,
 and is structured like this:

<pre>
{
	"error": "invalid session id",
	"message": "No active session with ID 1234",
	"stacktrace": ""
}
</pre>

<p>All the fields of the error object are required,
 so the stacktrace and message fields may be empty strings.
 The error field is on the other hand guaranteed
 to be one of the JSON error codes
 as laid out by the <a href=https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors>WebDriver standard</a>.


<h2 id=clients>Clients</h2>

<p>Clients may be implemented in any language
 that is capable of writing and receiving data over TCP socket.
 A <a href=https://searchfox.org/mozilla-central/source/testing/marionette/client>reference client is provided</a>.
 Clients may be implemented both synchronously and asynchronously,
 although the latter is impossible in protocol levels 2 and earlier
 due to the lack of message indexing.


<h2 id=bugs>Bugs</h2>

<p>Bugs are tracked
 in various <a href=https://bugzilla.mozilla.org/>Bugzilla</a> components:

<dl>
 <dt>Marionette server
 <dt>Marionette reference client
 <dt>Marionette test harness
 <dd><a href="https://bugzilla.mozilla.org/buglist.cgi?product=Testing&component=Marionette">Testing :: Marionette</a>

 <dt>geckodriver
 <dd><a href="https://bugzilla.mozilla.org/buglist.cgi?product=Testing&component=geckodriver">Testing :: geckodriver</a>
</dl>