Facebook login in Safari - using iOS simulator

I’m trying to make the following flow:

  1. Click on signIn with Facebook from my native app
  2. Set login credential on Facebook site (Safari)
  3. Back to approve in my app

I’m using Java, Appium 1.3.7, iOS 8.3 simulator.
Do i need to use driver.context(“WEBVIEW”) before finding the username and password text fields?

I can see the element using Appium Inspector but when running byXpath("//UIATextField[@value=‘Email address or phone number’]") i get this “An element could not be located on the page using the given search parameters”

My capabilities are set only for my native app.

Am I missing something?

Hello Hadarelb,

I am having exactly the same issue using Appium 1.3.7 and IOS 8.2 simulator.
Did you find what caused the error?

I can find element with inspector but when i launch some action on them (tap, touch …) I have this error in my log…


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();
Set contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1
driver.findElement(By.name(“email”)).sendKeys(“[email protected]”);

Apppium 1.4.13,
Java lib 3.2.0

@TheX could you able to solve this issue ?

I’m looking for solution where I need to log out of fb before start of test suite

Please let me know how do you handle this scenario ?