以下脚本在firefox中运行,但在Phanthon Js中不起作用
driver.manage().window().maximize();
// Enter UserName
driver.findElement(By.xpath(".//*[@type='text']")).sendKeys("admin");
// Enter Password
driver.findElement(By.xpath(".//*[@type='password']")).sendKeys(
"admin");
// Wait For Page To Load
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
// Click on 'Sign In' button
driver.findElement(By.xpath(".//button[@type='button']")).click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
WebElement webElement = driver.findElement(By.xpath("//button[contains(text(),'OK')]"));
webElement.click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//span[contains(text(),'Process')]"))
错误
Caused by: org.openqa.selenium.NoSuchElementException:
{"errorMessage":"Unable to find element with xpath
'.//span[contains(text(),'Process')]'","request":{"headers":{"Accept-
Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-
Length":"60","Content-Type":"application/json; charset=utf-
8","Host":"localhost:32339","User-Agent":"Apache-HttpClient/4.4.1
(Java/1.8.0_60)"},"httpVersion":"1.1","method":"POST","post":".......
有关此错误的文档,请访问:http://seleniumhq.org/exceptions/no_such_element.html