gecko-dev/testing/marionette
Henrik Skupin 06432fe10f Bug 1406763 - Fix broken Assert.throws() calls for error class. r=ato
MozReview-Commit-ID: H1fw7VitAyO

--HG--
extra : rebase_source : 18c741c99eda35e1084dfb51ea7ae72569428ac4
2017-10-12 17:56:31 +02:00
..
chrome
client Bug 1350897 - Tested quit shutdown/restart cause in Marionette Python client. r=whimboo 2017-10-03 10:48:30 +05:30
components Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
doc Bug 1375660 - Add instructions for updating the Selenium atoms. r=ato 2017-10-05 12:10:57 +02:00
harness Bug 1375660 - Remove duplicate button 9 reference in test_accessibility. r=ato 2017-10-02 23:58:01 +02:00
prefs
puppeteer Bug 1364349 - Removed platform property of Firefox Puppeteer. r=whimboo 2017-09-25 14:30:11 +05:30
.eslintrc.js Bug 1405279 - Lint for unused variables. r=whimboo 2017-10-03 14:36:09 +01:00
.jsdoc.js Bug 1405757 - Generate Marionette API docs to testing/marionette/doc/api. r=me 2017-10-04 18:35:12 +01:00
accessibility.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
action.js Bug 1405018 - Consider current browsing context on staleness check. r=whimboo 2017-10-10 15:06:21 +01:00
addon.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
assert.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
atom.js Bug 1275273 - Remove isElementSelected atom. r=maja_zf 2017-10-11 15:24:03 +01:00
browser.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
capture.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
cert.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
cookie.js Bug 1402978 - Add cookie domain field to WebDriver:AddCookie r=ato 2017-09-29 15:22:50 +01:00
dom.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
driver.js Bug 1405325 - Align WebDriver:DeleteCookie with specification. r=maja_zf 2017-10-03 16:25:57 +01:00
element.js Bug 1275273 - Make WebDriver:IsElementSelected conform to spec. r=maja_zf 2017-10-11 15:24:03 +01:00
error.js Bug 1394849 - Add error.stack to create stacktraces. r=automatedtester 2017-08-29 17:34:37 +01:00
evaluate.js Bug 1405018 - Consider current browsing context on staleness check. r=whimboo 2017-10-10 15:06:21 +01:00
event.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
format.js Bug 1403577 - Add utility for truncating strings. r=whimboo 2017-09-30 17:06:29 +01:00
frame.js Bug 1395176 - Use scoped remoteFrames instead of global. r=automatedtester 2017-08-30 17:37:33 +01:00
interaction.js Bug 1275273 - Make WebDriver:IsElementSelected conform to spec. r=maja_zf 2017-10-11 15:24:03 +01:00
jar.mn Bug 1404946 - Rename wait module to sync. r=whimboo 2017-10-02 16:38:33 +01:00
l10n.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
legacyaction.js Bug 1394881 - Use Node.isConnected for web element staleness check. r=automatedtester 2017-08-30 14:22:39 +01:00
listener.js Bug 1405018 - Consider current browsing context on staleness check. r=whimboo 2017-10-10 15:06:21 +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 1403577 - Fix Message, Command, and Response docs. r=whimboo 2017-09-30 18:15:03 +01:00
modal.js Bug 1384517 - Fix testing/marionette API docs; r=automatedtester 2017-07-26 13:11:53 +01:00
moz.build Backed out changeset ddfc127526b2 (bug 1403222) for failing python/mozbuild/mozbuild/test/frontend/test_reader.py::TestBuildReader::test_schedules, at least for Linux asan opt builds. r=backout on a CLOSED TREE 2017-10-02 16:03:12 +02:00
navigate.js Bug 1406150 - Always throw exceptions by using 'new'. r=maja_zf 2017-10-06 14:07:13 +02:00
packets.js Bug 1406150 - Always throw exceptions by using 'new'. r=maja_zf 2017-10-06 14:07:13 +02:00
proxy.js Bug 1395176 - Lint testing/marionette for var usage. r=automatedtester 2017-08-30 17:38:23 +01:00
README.md Bug 1407716 - Convert Marionette README to Markdown. r=maja_zf 2017-10-11 19:12:58 +01:00
reftest.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
reftest.xul
server.js Bug 1403577 - Associate message origin enum with Message type. r=whimboo 2017-09-30 18:13:23 +01:00
session.js Bug 1406763 - Strip brackets around IPv6 addresses for proxy hosts. r=ato 2017-10-09 14:10:03 +02:00
stream-utils.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
sync.js Bug 1404946 - Have PollPromise accept an options dictionary. r=whimboo 2017-10-02 17:13:57 +01:00
test_action.js Bug 1392318 - Use fromJSON convention in action module. r=automatedtester 2017-08-21 18:00:31 +01:00
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 1405240 - Fix test_cookie.js unit test assertions r=ato 2017-10-03 16:28:17 +01:00
test_dom.js Bug 1400225 - Subscribe to and relay web content DOM events. r=automatedtester,whimboo 2017-09-15 17:07:41 +01:00
test_element.js Bug 1275273 - Make WebDriver:IsElementSelected conform to spec. r=maja_zf 2017-10-11 15:24:03 +01:00
test_error.js Bug 1394849 - Add error.stack to create stacktraces. r=automatedtester 2017-08-29 17:34:37 +01:00
test_format.js Bug 1403577 - Add utility for truncating strings. r=whimboo 2017-09-30 17:06:29 +01:00
test_message.js Bug 1403577 - Rename TYPE identifier to Type. r=whimboo 2017-09-30 18:28:32 +01:00
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 1406763 - Fix broken Assert.throws() calls for error class. r=ato 2017-10-12 17:56:31 +02:00
test_sync.js Bug 1404946 - Have PollPromise accept an options dictionary. r=whimboo 2017-10-02 17:13:57 +01:00
transport.js Bug 1405279 - Remove unused variables. r=whimboo 2017-10-03 14:35:47 +01:00
unit.ini Bug 1404946 - Rename wait module to sync. r=whimboo 2017-10-02 16:38:33 +01:00

Marionette

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

Description

Marionette is an automation driver for Mozillas Gecko engine. It can remotely control either the UI or the internal JavaScript of Gecko-based browsers, such as Firefox and Fennec. 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 ready properties and attributes of the DOM.

Usage

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

% firefox -marionette
…
1491228343089	Marionette	INFO	Listening on port 2828

This binds to a TCP socket, over which clients can communicate with Marionette using the protocol.

Protocol

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.

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 mixing up responses.

Schematic flow of messages:

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

The protocol consists of a command message and the corresponding response message. A response message must always be sent in reply to a [commmand] message.

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 imlpementing the client end of this wire protocol.

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.

Command

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:

[type, message ID, command, parameters]
  • type must be 0 (integer). This indicates that the message is a command.

  • message ID is a 32-bit unsigned integer. This number is used as a sequencing number that uniquely identifies a pair of command and response messages. The other remote part will reply with a corresponding response with the same message ID.

  • command is a string identifying the RPC method or command to execute.

  • parameters is an arbitrary JSON serialisable object.

Response

The response message is also a four element array as shown below, and must always be sent after receiving a command:

[type, message ID, error, result]
  • type must be 1 (integer). This indicates that the message is a response.

  • message ID is a 32-bit unsigned integer. This corresponds to the commands message ID.

  • error is null if the command executed correctly. If the error occurred on the server-side, then this is an error object.

  • result is the result object from executing the command, iff it executed correctly. If an error occurred on the server-side, this field is null.

The structure of the result field can vary, but is documented individually for each command.

Error object

An error object is a serialisation of JavaScript error types, and it is structured like this:

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

All the fields of the error object are required, so the stacktrace and message fields may be empty strings. The error field is guaranteed to be one of the JSON error codes as laid out by the WebDriver standard.

Clients

Clients may be implemented in any language that is capable of writing and receiving data over TCP socket. A reference client is provided. 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 sequencing.

Bugs

Bugs are tracked in the Testing :: Marionette component.

Communication

The mailing list for discussion is tools-marionette@lists.mozilla.org (subscribe, archive). If you prefer real-time chat, there is often someone in the #ateam IRC channel on irc.mozilla.org. Dont ask if you can ask a question, just ask, and please wait for an answer as we might not be in your timezone.