Using the Browser Toolbox you can attach a debugger to the Marionette server session. This enables you to debug the chrome code inside Gecko, which is a far more powerful debugging technique than using console.log and inspecting gecko.log or adb logcat | grep -i Marionette.

The browser toolbox can be opened on launching Marionette tests by passing --jsdebugger to mach:

% ./mach marionette-test --jsdebugger

Alternatively, you can follow the steps described by the chrome debugger documentation.


Below is a list of the preferences that enable the chrome debugger for Marionette.  These are set implicitly when --jsdebugger is passed to mach.

Controls the remote connection prompt. Note that this will automatically expose your Firefox instance to the network.
To enable Marionette by default. This is the same as starting the binary with the --marionette flag.
Enables debugging of the chrome code.
Allows a remote debugger to connect, which is necessary for debugging the chrome code.

Redirecting the Gecko log

Another useful technique for debugging is to redirect the Gecko log output that normally ends up in the gecko.log file on Firefox desktop to stdout. This “merges” the test harness output and the stdout from the browser into a single stream.

This can be particularly effective when combined with using pdb in the client binding or the JS remote debugger.

Per Unix conventions you can use - (dash) to have Firefox write its log to stdout instead of file:

% ./mach marionette-test --gecko-log -

Document Tags and Contributors

 Contributors to this page: ato, chmanchester
 Last updated by: ato,