[@naukriengineering] mobile web app scripts execution using appium

14
Mobile web app scripts execution on real Android device using Garima Goel (Naukri Quality)

Upload: naukricom

Post on 21-Jan-2017

118 views

Category:

Mobile


0 download

TRANSCRIPT

Mobilewebappscriptsexecutiononreal

Androiddeviceusing

Garima Goel (Naukri Quality)

WhyAppium?Advantages of using appium for mobile site Test script execution: •  Different Android devices

•  Different versions of Android OS

•  Reduces manual Effort

•  Reduces Testing time

•  Larger ROI on Automation test scripts

•  Responsive Pages automation

Appium Architecture

On an Android device, Appium uses the UIAutomator framework to automate the apps.

When we execute the test scripts, Appium sends the command to the UIAutomator running on the device. Here, bootstrap.jar is used to execute the test command in order to perform the action on the Android device.

Appium on Android

Additional prerequisites to use Appium

Apart from current selenium setup, we need to configure following setup on our machine

Android SDK tools (API>=17)

ADT plugin for Eclipse

Appium server

Appium client libraries

AVD or real device

Appium Server There are 2 ways to

start the Appium server:

• Using command prompt - Type command: “appium &” to start the server.

• Using Appium GUI - Click “Launch Appium Server” button in the appium GUI to start the server

Before server Start

After server Start

Setup to be done on mobile device before start working with Appium

Mobile web app test script

execution on real device

We will now study how to execute selenium test scripts in native chrome browser of real android device.

Code to initialize Android Chrome browser

Following steps are to be followed to execute the mobile site test scripts on real android device

•  Enable USB debugging option in the android device

•  Connect the device to the laptop and type “adb devices” in the command prompt to check device is connected.

•  Start the Appium server.

•  Run the project using ant/maven command.

•  The test scripts will start executing in the Chrome browser of the connected mobile device.

Issues faced while test script

execution in Chrome

ElementNotClickableException

InvalidSelectorException

Slow Window Switching

No support for Actions class

Use JavaScript or sendkeys(Keys.Enter) to click

the element in chrome browser

Use Explicit Wait / Webdriver Wait to avoid

InvalidSelectorException

Use Thread.sleep() after switching to window.