TestProject Forum
Powered by leading experts in the test automation community

Hybrid app automation with appium + selenium

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.

Set<String> contextNames = driver.getContextHandles();
    for (String name : contextNames) {
    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

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: