7.2.2.Writing the Test

Using Appium’s Inspector you can get all the selectors for the current view’s element. To do so, launch your app by creating a new session in Appium. In Appium Desktop the inspector automatically opens once the session has been created. In the older version, you’ll need to click the hourglass button after the session has been created. We will need to add the element we want to interact with to the POM, first. Then we can use it in the test class.

Open “HomePage.java”

In the “Page Elements” region, add public AppControl elementName = new AppControl(By.id("elementID"));

Use the Device Farm console to upload your tests:

In the list of projects, choose the option next to the project where you want to upload your tests.

Tip: If the list of projects is not displayed, then on the secondary navigation bar, for Projects, choose the name of the project where you want to upload your tests.
To create a new project, follow the instructions in Create a Project.

If the Create a new run button is displayed, then choose it.

On the Choose your application page, choose Upload.

Browse to and choose your Android app file. The file must be an .apk file.

Choose Next step.

On the Configure a test page, choose Appium Java TestNG, and then choose Upload.