I developed a hybrid application using an ionic framework. Now it's time to test my application, so I chose appium to automate it. I saved the appium setup, and my application is installed on my device, connected via usb.
I wrote a test sample to bloom the login button and send the keys to the required fields, such as email and pwd. I used uiautomatorviewer to find my items with id. eg:driver.findElement(By.id("io.mysoft.testapp:id/login")).click();
Everything is clear and beautiful so far, but my sample test did not show me errors, such as
FAILED: Loginforsample
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: 5.51 seconds
After much research, I found out that we need to switch to WEB_VIEW in the testing logic on driver.context("WEB_VIEW");. I also tried to get WEB_VIEW using the following code:
Set<String> contextNames = ((AppiumDriver) driver).getContextHandles();
for (String contextName : contextNames) {
System.out.println("FIRST" + contextNames);
((AppiumDriver) driver).context(contextName);
}
NATIV_APP , WEB_VIEW. , WEB_VIEW, setWebContentsDebuggingEnabled webView, -, .
angular, . -, .. java . , , - setWebContentsDebuggingEnabled ()? - ? , , . , , . .
.