Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Appium Essentials

You're reading from  Appium Essentials

Product type Book
Published in Apr 2015
Publisher
ISBN-13 9781784392482
Pages 188 pages
Edition 1st Edition
Languages

The Selenium JSON wire protocol


The JSON wire protocol (JSONWP) is a transport mechanism created by WebDriver developers. This wire protocol is a specific set of predefined, standardized endpoints exposed via a RESTful API. The purpose of WebDriver and JSONWP is the automated testing of websites via a browser such as Firefox driver, IE driver, and Chrome driver.

Appium implements the Mobile JSONWP, the extension to the Selenium JSONWP, and it controls the different mobile device behaviors, such as installing/uninstalling apps over the session.

Let's have a look at some of the endpoints from the API which are used to interact with mobile applications:

  • /session/:sessionId

  • /session/:sessionId/element

  • /session/:sessionId/elements

  • /session/:sessionId/element/:id/click

  • /session/:sessionId/source

  • /session/:sessionId/url

  • /session/:sessionId/timeouts/implicit_wait

Appium provides client libraries similar to WebDriver that act as an interface to the REST API. These libraries have functions similar to the following method:

AppiumDriver.getPageSource();

This method will issue an HTTP request to the JSONWP, and it gets the response from the applicable API endpoint. In this case, the API endpoint that handles the getPageSource method is as follows:

/session/:sessionId/source

The driver will execute the test script that comes in the JSON format from the AppiumDriver server to get the source. It will return the page source in the string format. In case of non-HTML (native mobile apps) platforms, the Appium library will respond with an XML document representation of the UI hierarchy. The specific structure of the document may vary from platform to platform.

You have been reading a chapter from
Appium Essentials
Published in: Apr 2015 Publisher: ISBN-13: 9781784392482
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}