org.openqa.selenium.NoSuchElementException:无此类元素:无法 定位元素:{“方法”:“ xpath”,“选择器”:“ // * [@ id ='errorData']”}
使用的代码
public void amberLoginWithFacebook(String username, String pass) throws InterruptedException {
actions.driver.switchTo().defaultContent();
actions.driver.switchTo().frame(0);
actions.clickOn(By.cssSelector(facebookBtn));
Thread.sleep(2000);
Set<String> handler = actions.driver.getWindowHandles();
Iterator<String> loop = handler.iterator();
String parentWindow = loop.next();
String childWindow = loop.next();
actions.driver.switchTo().window(childWindow);
if (actions.driver.getTitle().toLowerCase().equals(facebookWindowTitle)) {
actions.setText(By.cssSelector(facebookEmail), username);
actions.setText(By.cssSelector(facebookPass), pass);
actions.clickOn(By.cssSelector(facebookLoginBtn));
Thread.sleep(2000);
}
actions.driver.switchTo().window(parentWindow);
// i get the exception here
if (actions.waitUntil(By.xpath("NonlinkedAccountError"), "presenceOfElement") != null)
{setCountryCode(properties.getProperty("CountryCode"));
setPhone(properties.getProperty("phone"));
actions.clickOn(By.xpath(defaultBtn));
actions.clickOn(By.xpath(enterEmail));
setEmail(properties.getProperty("email"));
}