Skip to main content


Showing posts from May, 2015


Back to Appium Tutorial Index Element Location Strategy  -  Launch UIAutomationViewer as -  uiautomatorviewer & Following is an example for UIAutomationViewer and using it to find elements on Android App. Herein an image of UIAutomationViewer with calculator application -  The Element 64 can be identified as -  driver.findElement("64")); driver.findElement("")); driver.findElement(By.className("android.widget.EditText")); Element location by TagName is deprecated. Refer Stackoverflow  post1  and  post2  for more on this. You can also use xPath strategy to identify element as described in this  post . Appium also supports  Mobile JSON Wire Protocol  locator strategy - -ios uiautomation : a string corresponding to a recursive element search using the UIAutomation library (iOS-only) -android uiautomator : a string corresponding to a recursive element search

Executing appium tests on Android mobile web

Back to Appium Tutorial Index Having set up appium, lets run our first tests. But before that start the appium and android device /  emulator as following - navigate to appium installation, which is following on my Ubuntu - /home/tarun/node-v0.12.2-linux-x64/bin and start appium from command line or using Appium Desktop app ./appium Open another command prompt and execute - adb devices and you should see list of devices attached as - List of devices attached emulator-5554    device If you see any error message then re-verify all the steps mentioned earlier to make sure none of the step is missed Sample JUnit project to run tests on android emulator Clone the following appium project - :tarun3kumar/appium-tests.git Import project in IDEA (or your favorite IDE) and Open AndroidEmulatorWebTest class - Right click on method testMobileWebOnEmulator and click Run. This would execute test on android emulator - Sample JUnit

Set up an android device to run appium tests

Back to Appium Tutorial Index While emulators are cheap solutions to run automated tests on mobile device. They can not emulate behavior of real device. if your requirement is to run tests on a mobile chrome browser then you are better off using android device since chrome browser can not be installed on emulator. Following configurations are required to be able to run tests on mobile device - Download appropriate version of chrome browser on your device Enable to Developer Mode on device. For ex, to enable developer mode on moto-4.4.4 do following - Tap   Tap Settings Tap  About phone Tap the Build number field 7 times You will begin seeing a message as you approach the 7 touches Tap the back arrow once complete, and Developer options will now appear under Settings. Once the developer options are enabled under settings in Moto G, it will be there permanently. Hence it is not necessary to repeat these procedures again.You can also disable the developers o

Appium and Android setup

Back to Appium Tutorial Index Android Requirements Android SDK API >= 17 (Additional features require 18/19) Appium supports Android on OS X, Linux and Windows. Follow these directions for setting up your environment properly for testing on different OSes: linux osx windows Android setup does not differ greatly on different operating system. Let’s look at detailed setup instructions for Ubuntu  - Installing Appium app on MAC or Windows    installation-via-desktop-app-download Installing Appium on Ubuntu  - Install node.js (v0.10 or greater) - Since appium server is written in node.js, first node.js needs to be installed. Following this appium can be installed from npm - Setup with Ubuntu: curl -sL | sudo bash - Then install with Ubuntu: sudo apt-get install -y nodejs DON’T install node js using above method, it would result in following error when starting appium - error: Appium will not work if used or ins

Appium Concepts

Back to Appium Tutorial Index Client/Server Architecture Appium (to be more precise Appium Server) is a web server which exposes a REST API. It performs following operations - Receives connections from a client, Listens for commands, Executes those commands on a mobile device, Responds with an HTTP response representing the result of the command execution. Since Appium uses client server architecture, we can write our test code in any language that has a http client API, though it is easier to use one of the Appium client libraries . Appium server can be on a different machine than the one running test. Session Automation is performed in the context of a session. Clients initiate a session with a server specific to each library, but they all eventually send a POST /session request to the server, with a JSON object known as 'desired capabilities' object. At this point the server will start up the automation session and respond with a session ID which i

Appium Philosophy

Back to Appium Tutorial Index from Appium philosophy has four tenets - Application under test should not have to be modified to be able to run automated tests Automated tests should not be tied to one framework or programming language A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs. A mobile automation framework should be open source, in spirit and practice as well as in name! Appium meets its philosophy in following ways - Appium satisfies its first Philosophy by using vendor-provided automation frameworks to control device. Hence Appium-specific or third-party code or frameworks do not have to be compiled with app under test. Hence you are testing same app which would be shipped. The vendor-provided frameworks Appium uses are:   iOS 9.3 and above: Apple's XCUITest iOS 9.3 and lower: Apple's UIAutomation Android 4.3+: Google's UiAutomator/UiAutomator2 Appium satisfies its s