package com.mypro1.jase; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.*; public class baidu { public static void main(String[] args) { System.out.println("srart selenium"); WebDriver driver = new FirefoxDriver(); driver.get(" http://www.baidu.com/ "); WebElement txtbox=driver.findElement(By.id("kw")); txtbox.sendKeys("selenium java"); WebElement btn=driver.findElement(By.id("su")); btn.click(); driver.close(); System.out.println("end selenium"); } } 报错提示: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function at com.mypro1.jase.baidu.main(baidu.java:9) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 1 more
https://www.cnblogs.com/dieyaxianju/p/6791428.html
希望对你有用