【发布时间】:2022-06-12 16:49:36
【问题描述】:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Frst{
public static void main(String[] args) {
// declaration and instantiation of objects/variables
System.setProperty("webdriver.chrome.driver", "F:\\Eclipse\\New folder\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
// Launch website
driver.navigate().to("http://www.google.com/");
// Click on the search text box and send value
driver.findElement(By.id("lst-ib")).sendKeys("hudai");
// Click on the search button
driver.findElement(By.name("btnK")).click();
}
}
错误:无法初始化主类 Frst 原因:java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
【问题讨论】:
标签: java selenium-chromedriver