Hello everybody,
We have an native iOS application with facebook login integration.
When user tap on button for FB login, he goto Safari browser and enter his creds.
Sometimes my code works perfect, but at most time Appium cant get WebView or cant get elements on WebView or even it get elements, type creds and press login button but simulator show only login page without any actions.
I dont understand what happened wrong.
Some part of my plain test code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformVersion”, “9.1”);
capabilities.setCapability(“platformName”, “iOS”);
capabilities.setCapability(“deviceName”, “iPhone Simulator”);
driver = new IOSDriver(new URL(“http://someiphere:4723/wd/hub”), capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
webDriverWait = new WebDriverWait(driver, 30);
driver.findElement(By.name(“button sign up facebook”)).click();
webDriverWait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAWebView[1]")));
Set contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1
}
driver.context(contextNames.toArray()[1].toString());
webDriverWait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name(“login”)));
driver.findElement(By.name(“email”)).sendKeys(“[email protected]”);
driver.findElement(By.name(“pass”)).sendKeys(“coolpassword”);
driver.findElement(By.name(“login”)).click();
Apppium 1.4.13,
Java lib 3.2.0