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

[@NaukriEngineering] Mobile Web app scripts execution using Appium

Jan 21, 2017

Download

Mobile

Naukri.com
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: [@NaukriEngineering] Mobile Web app scripts execution using Appium

Mobilewebappscriptsexecutiononreal

Androiddeviceusing

Garima Goel (Naukri Quality)

Page 2: [@NaukriEngineering] Mobile Web app scripts execution using Appium

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

Page 3: [@NaukriEngineering] Mobile Web app scripts execution using Appium

Appium Architecture

Page 4: [@NaukriEngineering] Mobile Web app scripts execution using Appium

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

Page 5: [@NaukriEngineering] Mobile Web app scripts execution using Appium

Additional prerequisites to use Appium

Page 6: [@NaukriEngineering] Mobile Web app scripts execution using 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

Page 7: [@NaukriEngineering] Mobile Web app scripts execution using Appium

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

Page 8: [@NaukriEngineering] Mobile Web app scripts execution using Appium

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

Page 9: [@NaukriEngineering] Mobile Web app scripts execution using 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.

Page 10: [@NaukriEngineering] Mobile Web app scripts execution using Appium

Code to initialize Android Chrome browser

Page 11: [@NaukriEngineering] Mobile Web app scripts execution using Appium

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.

Page 12: [@NaukriEngineering] Mobile Web app scripts execution using Appium

Issues faced while test script

execution in Chrome

ElementNotClickableException

InvalidSelectorException

Slow Window Switching

No support for Actions class

Page 13: [@NaukriEngineering] Mobile Web app scripts execution using Appium

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.

Page 14: [@NaukriEngineering] Mobile Web app scripts execution using Appium