Hello.
I’m automating an iOS mobile app.
Real device - iphone 6+, 10.3.3
Appium 1.7.2
Java - compile group: ‘io.appium’, name: ‘java-client’, version: ‘6.0.0-BETA2’
selenium - compile group: ‘org.seleniumhq.selenium’, name: ‘selenium-api’, version: ‘3.8.1’
Everything works ok (native part), until i have 1 section in the app (payment process) where an webview is presented. I can identify elements using safari developer mode:
Ex:
public By getCardType = By.xpath("//*[@id=\"KKName\"]/option[1]"); public By visaCard = By.xpath("//*[@id=\"KKName\"]/option[2]"); public By cardNumberInput = By.xpath("//*[@id=\"cardnumber\"]"); public By cardNumberInput2 = By.id("cardnumber");
When I’m running switch to webview method, it says that no webview is found:
public static void switchToWebview() throws Exception { MyLogger.log.info("Trying to switch to first non NATIVE_APP view"); boolean foundNonNativeContext = false; for (String context : getContextHandles()) { if ((!foundNonNativeContext) && !NATIVE_APP.equals(context)) { foundNonNativeContext = true; MyLogger.log.info("Found non native context: " + context); switchToContext(context); } } if (!foundNonNativeContext) { MyLogger.log.info("ONLY NATIVE_APP CONTEXT AVAILABLE"); } }
This are my caps:
caps.setCapability(“platformName”, “iOS”);
caps.setCapability(“platformVersion”, “10.3.3”);
caps.setCapability(“deviceName”, deviceID);
caps.setCapability(“app”, APP_LOCATION());
caps.setCapability(“udid”, DEVICE_ID());
caps.setCapability(“newCommandTimeout”, 600);
caps.setCapability(“automationName”, AUTOMATION_NAME());
// caps.setCapability(MobileCapabilityType.ROTATABLE, true);
caps.setCapability(“wdaConnectionTimeout”, 60000);
caps.setCapability(“resetOnSessionStartOnly”, true);
caps.setCapability(“useNewWDA”, true);
caps.setCapability(“commandTimeouts”, “120000”);
caps.setCapability(“wdaLocalPort”, WDA_PORT());
caps.setCapability(“clearSystemFiles”, true);
What i’m doing wrong?
I’m getting this:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Can someone give me a hint?