1Debugging 2========= 3 4.. py:currentmodule:: marionette_driver.marionette 5 6Sometimes when working with Marionette you'll run into unexpected behaviour and 7need to do some debugging. This page outlines some of the Marionette methods 8that can be useful to you. 9 10Please note that the best tools for debugging are the `ones that ship with 11Gecko`_. This page doesn't describe how to use those with Marionette. Also see 12a related topic about `using the debugger with Marionette`_ on MDN. 13 14.. _ones that ship with Gecko: https://developer.mozilla.org/en-US/docs/Tools 15.. _using the debugger with Marionette: https://developer.mozilla.org/en-US/docs/Marionette/Debugging 16 17Seeing What's on the Page 18~~~~~~~~~~~~~~~~~~~~~~~~~ 19 20Sometimes it's difficult to tell what is actually on the page that is being 21manipulated. Either because it happens too fast, the window isn't big enough or 22you are manipulating a remote server! There are two methods that can help you 23out. The first is :func:`~Marionette.screenshot`:: 24 25 marionette.screenshot() # takes screenshot of entire frame 26 elem = marionette.find_element(By.ID, 'some-div') 27 marionette.screenshot(elem) # takes a screenshot of only the given element 28 29Sometimes you just want to see the DOM layout. You can do this with the 30:attr:`~Marionette.page_source` property. Note that the page source depends on 31the context you are in:: 32 33 print(marionette.page_source) 34 marionette.set_context('chrome') 35 print(marionette.page_source) 36