From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- testing/marionette/client/docs/interactive.rst | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 testing/marionette/client/docs/interactive.rst (limited to 'testing/marionette/client/docs/interactive.rst') diff --git a/testing/marionette/client/docs/interactive.rst b/testing/marionette/client/docs/interactive.rst new file mode 100644 index 000000000..e6d755613 --- /dev/null +++ b/testing/marionette/client/docs/interactive.rst @@ -0,0 +1,55 @@ +Using the Client Interactively +============================== + +Once you installed the client and have Marionette running, you can fire +up your favourite interactive python environment and start playing with +Marionette. Let's use a typical python shell: + +.. parsed-literal:: + + python + +First, import Marionette: + +.. parsed-literal:: + from marionette import Marionette + +Now create the client for this session. Assuming you're using the default +port on a Marionette instance running locally: + +.. parsed-literal:: + + client = Marionette(host='localhost', port=2828) + client.start_session() + +This will return some id representing your session id. Now that you've +established a connection, let's start doing interesting things: + +.. parsed-literal:: + + client.execute_script("alert('o hai there!');") + +You should now see this alert pop up! How exciting! Okay, let's do +something practical. Close the dialog and try this: + +.. parsed-literal:: + + client.navigate("http://www.mozilla.org") + +Now you're at mozilla.org! You can even verify it using the following: + +.. parsed-literal:: + client.get_url() + +You can even find an element and click on it. Let's say you want to get +the first link: + +.. parsed-literal:: + from marionette import By + first_link = client.find_element(By.TAG_NAME, "a") + +first_link now holds a reference to the first link on the page. You can click it: + +.. parsed-literal:: + first_link.click() + -- cgit v1.2.3