我正在努力学习硒。所以我安装了以下工具:
我使用下面的代码运行它并收到错误消息。不确定这意味着什么。任何帮助都会很好。
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Sele {
/**
* @param args
*/
public static void main(String[] args) {
// Create webDriver reference
WebDriver driver;
// Launch FirefoxDriver
driver = new FirefoxDriver();
// Open the web page
driver.get("http://google.com");
// Enter the text in the search box
WebElement searchText = driver.findElement(By.name("q"));
searchText.sendKeys("FirefoxDriver");
// Close the driver
driver.quit();
}
}
错误讯息:
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/RenderedWebElement
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at Sele.main(Sele.java:17)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.RenderedWebElement
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more