【发布时间】:2016-08-04 08:37:16
【问题描述】:
Selenium webdriver 必须等待代码中提到的 30 秒和 5 秒。但注意到 webdriver 正在跳过它。是什么原因以及如何让 webdriver 等待。
System.out.println("Before 5"+date.toString());
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
System.out.println("After 5"+date.toString());
完整代码的链接可以在这里找到 https://drive.google.com/file/d/0B4SgyzyvwKhiUk9KVldTa2ZGUkE/view?usp=sharing
【问题讨论】:
-
您能告诉我您说它不等待的依据是什么吗?是否在不等待 5 秒的情况下抛出 'NoSuchElememt' 或 element not found execption?
-
没有错误。通过打印等待前和等待后的时间来计算。
-
请查看发布的答案。
标签: selenium selenium-webdriver