public static void main(String[] args)
{
System.setProperty("webdriver.gecko.driver", "F:\\gecko_driver\\geckodriver-
v0.16.1-win64\\geckodriver.exe");
WebDriver driver= new FirefoxDriver();
driver.get("https://www.heycare.com");
driver.findElement(By.xpath( “HTML /体/格[2] /报头/ DIV / NAV / DIV / A”))点击();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
System.out.println("hello world-----1");
driver.switchTo().frame(0);
driver.findElement(By.id("mobile")).sendKeys("7015273543");
System.out.println("hello world-----2");
//Driver.findElement(By.id("mobile")).sendKeys("7015273543");
driver.findElement(By.id("Pass")).sendKeys("123456");
}
错误: - 线程“main”中的异常org.openqa.selenium.NoSuchElementException:无法找到元素:* [name ='mobile']
代码工作正常,直到: - driver.findElement(By.xpath(“html / body / div [2] / header / div / nav / div / a”)) . click();无法在单击登录按钮后弹出的弹出窗体上写入..