Working with web apps
Web apps can be run on any device or platform. The only requirement for running them is a web browser and an Internet connection; the best part is that you don't need to install the app on the device. Web apps are generally designed with cross-browser compatibility.
Web apps on Android
We will take the example of the Gmail login page. In this section, we are going to take a look at how to load the Chrome browser on a real device and then type in invalid credentials and click on the Sign in button that is shown in the following screenshot:
Let's start with the following steps to automate the web apps:
Set the desired capabilities to launch the Chrome browser:
caps.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
Now, we need to navigate to https://www.gmail.com using the
driver.get("https://www.gmail.com");
command.We need to find the
username
box element (we can take a reference from Chapter 4, Finding Elements with Different Locators, to find an element); in this...