Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Appium Essentials

You're reading from   Appium Essentials Explore mobile automation with Appium and discover new ways to test native, web, and hybrid applications

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781784392482
Length 188 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

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.

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime