Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Selenium与java一起使用时出现NoClassDefFoundError错误_Java_Selenium - Fatal编程技术网

将Selenium与java一起使用时出现NoClassDefFoundError错误

将Selenium与java一起使用时出现NoClassDefFoundError错误,java,selenium,Java,Selenium,我是Selenium的新手,我正在尝试访问google.co.in。我的代码是 public static void main(String[] args) { String baseUrl = "https://www.google.co.in/"; WebDriver driver = new FirefoxDriver(); driver.get(baseUrl); } 但是我得到了一个错误,在主线程java.lang.NoClassDefFoundE

我是Selenium的新手,我正在尝试访问google.co.in。我的代码是

public static void main(String[] args) {
      String baseUrl = "https://www.google.co.in/";
      WebDriver driver = new FirefoxDriver();
      driver.get(baseUrl);
}
但是我得到了一个错误,在主线程java.lang.NoClassDefFoundError:com/google/common/base/Function中显示Exception

在加载了相应的jar文件之后,我还编写了两条导入语句

import org.openqa.selenium.*;    
import org.openqa.selenium.firefox.FirefoxDriver;

我对selenium和java都是新手,所以请帮助我

必须添加此库:

selenium-server-standalone-version.jar

请在此下载:

selenium-java-version.jar