Using Appium to automate a hybrid application

I am trying to use Appium to run some automated tests on a hybrid mobile device built using PhoneGap. I am currently trying to get an automatic version of Android.

I successfully get tests to install .apk on an emulator and the application opens. I do this by starting the node server (not sure if there are other ways). This is as far as I could. I am not sure about the next steps I have to take in order to find the elements in my application and argue against them.

I am currently using the python test script because I found an example using python. However, I can do any language if there are resources for testing.

At this moment, I'm just confused about where to look. The Appium website does not seem to have full documentation of the commands that need to be used for testing.

+4
source share
3 answers

I am currently automating a hybrid application using Appium, and there is very little documentation. However, I figured out how to do this through trial and error.

Prerequisites:

1) Debug builds of your hybrid application

2) Use the Chrome browser> Tools> Inspect devices - to open the application’s web browsing component

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

4) script ,

if(browser.equalsIgnoreCase("android")){
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME,"");
    capabilities.setCapability("deviceName","Android");
    capabilities.setCapability("device","Android");
    capabilities.setCapability("takesScreenshot","true");
    capabilities.setCapability("platformName","Android");
    capabilities.setCapability("platformVersion","4.4.2");
    capabilities.setCapability("appPackage","uk.co.ee.myee");
    capabilities.setCapability("appActivity","uk.co.ee.myee.Launcher");

    capabilities.setCapability("udid","989fb005");

    driver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"),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) {
        System.out.println(contextName);
        if (contextName.contains("WEBVIEW")){
            driver.context(contextName);
        }
    }
}
+7

For hybrid applications, you can use the version of Android above 4.4 in appium mode, and for smaller versions you can use the "selendroid mode" appium. To check in selendroid mode, use the "selendroid inpector" by switching to coding debug mode and clicking the URL "Yourlocaldomain: 8080 / inspector" For appium mode, you can use the appium GUI for windows or Mac to search for items.

+1
source

All Articles