简体   繁体   中英

NoSuchElementFoundException when I am trying to click on elements in android web view

appium version: 1.12.1 windows 10 working platform=android version 5.1.1 Not working in android version 4.4, 6.0 and above

I am trying to click on the element in android web view where it is showing NoSuchElementFoundException

appDebuggingMode is on and also I have used a method to switch the context but it is showing available context as [NATIVE_APP] in all android platform

element is clickable in android version 5.1.1 (without switching the context working in native context) and not working in android version 4.4, 6.0 and above

I am trying to switch the context by using:

Set availableContexts = driver.getContextHandles();

    System.out.println("context available " +availableContexts);

    for (String context : availableContexts) 
              {
        if (context.contains("WEBVIEW")) {

            driver.context(context);        
                break;

                }
     }

I am trying to click on the element by:

WebDriverWait wait = new WebDriverWait(driver, 120);
wait.until(ExpectedConditions.visibilityOf(element)); 
element.click();

Please provide me solution to solve this problem.

Most probably your application is built for Android KitKat (or higher) which has debugging of elements which are in the WebView disabled.

You need to ask your application developers to enable the debugging of the elements which are inside the WebViews otherwise Appium will not be able to recognize them.

If for some reason it is not possible you can still proceed and perform instrumentation of the application which will unlock features required for successful testing including but not limited to the accessing contents of the WebViews.

And last but not the least you can work it around by going for a machine-vision-based test implementation and look for a specific image using Sikuli or other OpenCV -based tool

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