Download presentation
Presentation is loading. Please wait.
1
Automation for mobile apps Presenter: Nikita Mader
2
Tools we will learn and utilize today:
Plan for the session: What is Appium and how does it work Environment installation (75% of all efforts) Hands on experience in mobile automation Tools we will learn and utilize today: Android SDK including Android AVD Android ADB UI Automator Viewer Appium ;)
4
There are multiple reasons:
Selenium Webdriver is the standard for web automation. It is used daily by thousands of people. Last years Appium became one of the most popular tool for mobile automation. Why? There are multiple reasons: Test native, hybrid, web apps Cross-platform - Support Android and iOS Test mobile web (Safari for iOS and Chrome for Android) Does not require to recompile your app WebDriver API
5
So, what is Appium? Appium is an open source, cross platform tool for mobile automation. Appium ecosystem has a client-server architecture based on JSON wire protocol. Appium server is written on Node.js Basically, Appium is an HTTP server that creates and handles WebDriver sessions. Appium supports all Webdriver client libraries: Java, Python, Ruby, C#, Javascript
6
Features & Limitations:
Implements Selenium Webdriver interfaces Provides common libraries for all platforms Extends Selenium WebDriver with additional functionality such as: driver.pinch(), driver.zoom(), driver.current_activity(), driver.lock() Limitations: Android version 4.2+ required Requires Mac OSX for iOS automation
7
Architectur
8
Environment setup: Download Appium server from Android SDK Copy to C:\android-sdk Install Intel HAXM if running on emulator from C:\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager Download Appium JAR from maven repository search.maven.org - g:io.appium a:java-client 4. Download Selenium JAR from seleniumhq.org
9
Environment setup: Environment variables
Go to properties of computer -> Advanced system settings -> Environment variables -> and add “C:\android-sdk\tools;C:\android-sdk\platform-tools” to Path variable create new JAVA_HOME variable and provide path to JDK. Example: C:\Program Files\Java\jre7 create new ANDROID_HOME and provide path to SDK. Example: C:\android-sdk
10
Environment setup: Now lets verify we did everything correctly:
Open command prompt(CP) (Win+r -> type CMD) If you are going to use emulator type in CP “android avd” and press enter If you are using your phone please turn on USB debugging in developer settings (7 taps) If you see AVD manager opened you are done, if not please check environment variables Create new AVD Check its status(or your Android phone connected) by typing “adb devices” in CP
11
Appium methods overview
Lock the screen: driver.lockScreen(); Send the currently active app to the background: driver.runAppInBackground(); Hide the keyboard: driver.hideKeyboard(); Open the notification shade Android only: driver.openNotifications(); Check if an app is installed: driver.isAppInstalled("com.example.android.apis");
12
Appium methods overview
Install an app to the device: driver.installApp("path/to/my.apk"); Remove an app from the device: driver.removeApp("com.example.android.apis"); Simulate the device shaking: driver.shake(); Close the app: driver.closeApp(); Send a key event to the device: driver.sendKeyEvent(AndroidKeyCode.HOME);
13
Appium methods overview
TOUCHACTION / MULTITOUCHACTION: TouchAction action = new TouchAction(driver) .press(mapview, 10, 10) .release(). perform(); Pinch the screen: driver.pinch(element); Zoom the screen: driver.zoom(element); Pull a file from the device: driver.pullFile("Library/AddressBook/AddressBook.sqlitedb"); Send key code to the device(Android): driver.sendKeyEvent(AndroidKeyCode.HOME); or
14
Appium methods overview
Scroll to an element: WebElement element = driver.findElement(By.name("Element Name")); HashMap<String, String> arguments = new HashMap<String, String>(); arguments.put("element", element.getId()); (JavascriptExecutor)driver.executeScript("mobile: scrollTo", arguments); Adjusting Network Connection: driver.setNetworkConnection(1); driver.getNetworkConnection(1)
15
Lets move on to the hands on session!
File appdir = new File("src"); File app = new File(appdir, "MyNetDiaryCalorieCounter.apk"); DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability( MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID ); cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android emulator"); cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100"); driver = new AndroidDriver(new URL(" cap); …………… …… … .. .
16
https://github.com/appium/appium-dot-app
Resources
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.