logan_gabriel logan_gabriel - 1 year ago 109
Android Question

Using Appium to Automate Hybrid App

I am attempting to use Appium to run some automated tests on a hybrid mobile device built using PhoneGap. I am currently trying to get the android version automated.

I am successful at getting the tests to install the .apk onto the emulator, and the application is opened. I am doing this by running a node server (not sure if there are other ways). This is as far as I have been able to get. I am unsure of the next steps I have to take to find elements within my app and assert against them.

I currently am using a python test script because I found an example using python. However, I am up for any language as long as there are resources out there for running tests.

At this point I'm just confused on where to look. The Appium website does not seem to have thorough documentation on commands to use for testing.

Answer Source

I am currently automating a hybrid app using Appium, and there is very little documentation available. However, I have figured out how to get this done by trial and error.


1) Debug build of your Hybrid App

2) Use Chrome browser > Tools > Inspect devices - to expose the webview component of the app

3) You need to use xpath to identify the object at console

4) While executing your script use switch context as shown below

    DesiredCapabilities capabilities = new DesiredCapabilities();


    driver = new AppiumDriver(new URL(""),capabilities);
    //driver = new AppiumSwipeableDriver(new URL("galaxy_s5_scl23.appkitbox.com:50305"),capabilities);

    touch = new TouchAction(driver);
    Set<String> contextNames = driver.getContextHandles();
    for (String contextName : contextNames) {
        if (contextName.contains("WEBVIEW")){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download