简体   繁体   中英

How to start coding automation for MObile app Webview

I am trying to code an automation test for a hybrid mobile app using Selenium and Appium. I have no issues in interacting with elements in the native portion of the app, but it's the webview part that's bothering me. It always hit "Unable to find element" errors using the standard "findElement" (the xpaths,ID etc are otained from Appium's Element inspector). However, when I use the Touchaction objects, it pretty much able to interact with the elements, albeit 90% of time, but I do not wish to use TouchAction. I would like to know, what is the standard way to write code to test Webviews,as in do I need to create a special function or declare/import any specific libraries? Yes, google is a popular method, but it does not specifically show the ONE way to kickstart webview-android testing. Thanks. Let me know if you need more info.

Appium Desired Capabilities

Try to put autoWebview with true value in you capability:

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("autoWebview", true);

And switch it first to driver.context("WEBVIEW_1");

Automating Hybrid Apps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM