TestProject Forum

General => Appium => Topic started by: Sebastian on May 02, 2016, 18:21:10 pm

Title: Hybrid app automation with appium + selenium
Post by: Sebastian on May 02, 2016, 18:21:10 pm
I want to automate a hybrid app using appium and selenium. The problem I have is getting the object properties.
I'm using UI automator to identify elements but its not working. It only identifies the outer or parent frame of the app and nothing else.

I tried a physical device and emulator as well (Genymotion). Android 4.3 and above.

For handling hybrid apps we have to switch the contexts between Native view and Webview according to our needs.

Code
Set<String> contextNames = driver.getContextHandles();
    for (String name : contextNames) {
        System.out.println(name);
    }
    driver.context(contextNames.toArray()[1].toString()); // set context to webview

For Hybrid apps I couldn't find a tool to get the object properties. Only way I could find is using inspect element in chrome and getting the xpath.
However, I was able to use inspect element only on genymotion emulator, not with real physical device.

If anyone could enlighten me on the matter it would be greatly appreciated
Title: Re: Hybrid app automation with appium + selenium
Post by: Oren on May 02, 2016, 20:20:36 pm
It should be possible to use the Appium Inspector to find the xpath of the element, then call xpath within your test cases.

Appium also contains a step to switch contexts between web and native:

Code
switch_context(context)