Impossible to login by Facebook via Safari

Hello.

I have follow issue: I try to automate login process in app through Facebook. I used follow code to fill login fields:

webDriverWait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAWebView[1]"))); Set<String> contextNames = wd.getContextHandles(); wd.context(contextNames.toArray()[1].toString()); webDriverWait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("login"))); wd.findElement(By.name("email")).sendKeys("[email protected]"); wd.findElement(By.name("pass")).sendKeys("test"); wd.findElement(By.name("login")).click();

But nothing happened. In log:

{"UIATextField":{"@":{"name":null,"label":null,"value":"Email address or phone number","dom":{"id":""},"enabled":true,"valid":true,"visible":true,"hint":"","path":"/0/1/3/0/0/4","x":16,"y":290,"width":344,"height":46},">":[]}}, {"UIASecureTextField":{"@":{"name":null,"label":null,"value":"Facebook password","dom":{"id":"u_0_1"},"enabled":true,"valid":true,"visible":true,"hint":"","path":"/0/1/3/0/0/5","x":16,"y":335,"width":344,"height":45},">":[]}}

Why driver can’t reach names of fields? How can I avoid this problem? I have tried xpath, but got same results.

When I had removed “webDriverWait.until…” follow issue appeared:

WARNING: WebDriverException thrown by findElement(By.name: login) org.openqa.selenium.InvalidSelectorException: Locator Strategy 'name' is not supported for this session (WARNING: The server did not provide any stacktrace information)

I use follow software:

  • OS X 10.11.4
  • Appium v. 1.5.2
  • iOS emulator: iPhone 6 with iOS 9.1