1
我正在执行简单的java程序并尝试执行我的第一个硒脚本。在执行硒web驱动程序时得到异常
public static void main(String[] args) {
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
这些都是我所添加的相关性:
但运行此代码后,我得到这个例外蚀。
java.lang.ClassNotFoundException: org.apache.xerces.xni.XNIException
为什么你有xerces.jar,我不认为它需要运行硒脚本。删除并再次尝试。 – 2014-09-25 10:55:27