Files
sousa-gecko/testing/marionette/client/docs/advanced/debug.md
T
Sylvestre Ledru 8f033c8241 Bug 2038819 - Convert testing/**/docs RST to Markdown r=jdescottes,firefox-source-docs-reviewers,ahal
Convert testing/{awsy,condprofile,docs,geckodriver,marionette,
mozbase,mozharness,perfdocs,performance,raptor,talos,web-platform}
RST documentation files to MyST-flavored Markdown.

Skips testing/perfdocs/generated/* (auto-generated by mach perfdocs)
and testing/web-platform/tests/* (third-party test trees).

- Move treeherder-try frontmatter substitutions under the new myst
  topmatter key.
- Allow the pre-existing autodoc Unknown target warning for
  mozprofile.permissions to keep the build clean.
- Refresh allowed-warnings glob for manifest-sandbox download from
  .rst to .md.

Differential Revision: https://phabricator.services.mozilla.com/D304228
2026-07-04 10:18:34 +00:00

1.4 KiB

Debugging

.. py:currentmodule:: marionette_driver.marionette

Sometimes when working with Marionette you'll run into unexpected behaviour and need to do some debugging. This page outlines some of the Marionette methods that can be useful to you.

Please note that the best tools for debugging are the ones that ship with Gecko. This page doesn't describe how to use those with Marionette. Also see a related topic about using the debugger with Marionette on MDN.

Seeing What's on the Page

Sometimes it's difficult to tell what is actually on the page that is being manipulated. Either because it happens too fast, the window isn't big enough or you are manipulating a remote server! There are two methods that can help you out. The first is {func}~Marionette.screenshot:

marionette.screenshot() # takes screenshot of entire frame
elem = marionette.find_element(By.ID, 'some-div')
marionette.screenshot(elem) # takes a screenshot of only the given element

Sometimes you just want to see the DOM layout. You can do this with the {attr}~Marionette.page_source property. Note that the page source depends on the context you are in:

print(marionette.page_source)
marionette.set_context('chrome')
print(marionette.page_source)