嗨,我只是在学习Webdriver。我自动化的流程有5个屏幕。 2个屏幕,我能够使用webdriver导航。在第二个屏幕中输入详细信息并单击ENTER后,第三个屏幕未在Webdriver浏览器中加载。
当我手动尝试此功能时,此功能正常。我已经尝试了各种逻辑来等待页面继续并搜索不可见的元素。
这是webdriver浏览器的一些限制吗?
WebDriver driver = new FirefoxDriver();
driver.get("url");
// Find the text input element by its name
WebElement element = driver.findElement(By.className("clicButton"));
// Enter something to search for
element.click();
System.out.println("completed start");
WebElement element1 = driver.findElement(By.name("contactphone"));
element1.sendKeys("number");
// Now submit the form. WebDriver will find the form for us from the element
//element1 = driver.findElement(By.id("the id"));
//element1.click();
element1.sendKeys(org.openqa.selenium.Keys.ENTER);
System.out.println("clicked continue");
//WebDriverWait wait = new WebDriverWait(driver,10);
//WebElement element2 = wait.until(driver.findElement(By.name("name")));
//wait.until(driver.findElement(By.name("name")).isDisplayed());
new WebDriverWait(driver, 60)
.until(ExpectedConditions.presenceOfElementLocated (By.name("name")));
线程“main”org.openqa.selenium.TimeoutException中的异常:60秒后超时,等待位于以下位置的元素:By.name:name 构建信息:版本:'未知',修订版:'未知',时间:'未知' 系统信息:os.name:'Windows XP',os.arch:'x86',os.version:'5.1',java.version:'1.6.0_20' 驱动程序信息:driver.version:未知 at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:255) 在org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:270) 在org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:222) 在LoadUsers.main(LoadUsers.java:49) 引起:org.openqa.selenium.NoSuchElementException:无法找到元素:命令持续时间或超时:0毫秒
答案 0 :(得分:0)
几个选项: