Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
初学selenium2.0请教各位大侠网页时抛出异常。selenium2.0是如何捕获和处理页面异常的?
我不想因为不寻常的问题而停下来让整个测试过程。有没有类似qtp恢复功能的场景?如果我们平时遇到这个异常问题是如何解决的...
谢谢你!!
查看有关异常的 Oracle Java 教程。
简短的回答是,所有 WebDriver 方法都会抛出Exceptions您可以捕获和处理的特定类型。
Exceptions
WebElement elem = null; try { elem = driver.findElement(By.id("someId")); } catch (NoSuchElementException e) { log.error(e.getMessage()); throw e; // or not if this error was expected, program then continues }