Skip to main content

FAQ


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(By.name("64"));
  • driver.findElement(By.id("com.android.calculator2:id/formula"));
  • 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 using the UiAutomator Api (Android-only)
  • accessibility id: a string corresponding to a recursive element search using the Id/Name that the native Accessibility options utilize

Update chrome driver binaries -
At times chrome browser on real device may not work and can be fixed by updating chrome driver binaries which are downloaded by appium. download latest chrome driver binaries from -
And replace them in your appium download location, The location looks as following on my Ubuntu - /home/tarun/node-v0.12.2-linux-x64/lib/node_modules/appium/build/chromedriver/linux
Using Chrome browser on non rooted devices -
If you have a non rooted device then chrome would work for only version higher than 33, so if you using a version of chrome lower than 33.0 then upgrade it to higher version. This may be far easier than rooting the device :-) Moreover since chrome browser update automatically on Android hence you would like to test on latest version of chrome browser.
Killing a running instance of adb -


If you come across following error when executing tests -
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: /bin/sh -c /home/tarun/Documents/mine/lib/android-sdk-linux/platform-tools/adb -s adb server is out of date.  killing... wait-for-device ADB server didn't ACK * could not start server *)
then you may already have adb server up and running and you would have kill it. kill adb from command line as following -
killall -9 adb


How do I find the device version and name -
Couple of examples on other sites set VERSION and deviceName capabilities for android but appium seem to ignore it for android. Any way, these capabilities may be used by Appium in future and can be set as - 

capabilities.setCapability(CapabilityType.VERSION, “4.4”);
If your device is running 4.4.2 then VERSION is 4.4, if your device is running 5.1.1 then version is 5.1 and so on
With appium version 1.3.7 following message is logged in appium server which indicates that VERSION capability is anyway ignored by appium -

info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
The deviceName capability can be set as - 

capabilities.setCapability(“deviceName”, “111bd508″);
The device name is found using adb command as - 
adb devices -l

List of devices attached 
emulator-5554          device product:sdk_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64
Herein emulator-5554 is the deviceName

The deviceName capability is currently ignored for Android. Reference


Error: Unable to find an active device or emulator with OS 8.1. The following are available: emulator-5554 (7.1)
If you encounter this error then you need to specify PLATFORM_VERSION capability as following -

capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1");
I used version 7.1, use which ever version is applicable for your device

Popular posts from this blog

Distributed Load Testing with JMeter

Distributed Testing with JMeter When one JMeter client is not able to offer amount of threads required for load testing then distributed testing is used. In distributed testing - One instance of JMeter client can control number of JMeter instances and collect data from them Test plan does not need to be copied to each server, the client sends it to all servers note - JMeter will run all the threads on all the servers, hence 100 threads on 5 JMeter server would pump 500 threads in total. If many server instances are used, the client JMeter can become overloaded and so the client network connection. This has been improved in latest versions of JMeter by switching to Stripped modes, but you should always check that your client is not overloaded When Client (master) and Server (slave) nodes are on same network (no SSH required) Configure Client Node Herein client is referred as the machine controlling test execution on other JMeter nodes. This is also referred

Appium and android mobile app automation

Next appium and Android mobile app automation video tutoria l is live. If you are new to appium then please check - appium-tutorial This video tutorial covers - Start vysor (Just for this session and not mobile automation :)) Start appium and start appium inspector Desired Capabilities platformName - Android deviceName - L2N0219828001013 (as seen on "adb devices") Saved Capability Sets Start Session Scan app elements using appium inspector Get appPackage and appActivity using "APK info" app Install "APK info" app and open app whose appPackage and appActivity are required i.e. calculator Check top section of app icon com.android.calculator2 is app package com.android.calculator2.Calculator is app activity testng.xml file settings for running Android app tests Test details com.seleniumtests.tests.mobile.AndroidAppTest and CalculatorScreen class View beautiful STF test report  

Verify email confirmation using Selenium

Note: If you are new to java and selenium then start with selenium java training videos .     Email confirmation seems to be integral part of any registration process. I came across an application which lets you provide your email address. You can follow the sign up link in you mail and then complete the registration process. Lets consider we provide GMail address for it. Now if were to use only Selenium then we would have to follow following steps - Launch GMail using Selenium; Some how search for new mail in the list of available mails; Some how click on it; Parse the mail message; Get the registration link; Follow up with registration process What do you think of an approach in which you can