>xception in thread "main" java.lang.IllegalStateException: 驱动程序可执行文件不存在: C:\Sujata_Selenium_workspace\chromedriver.exe显示错误。
包硒网络驱动程序;
import org.openqa.selenium.WebDriver;import org.openqa.selenium.chrome.ChromeDriver;
公共类启动浏览器 {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\Sujata_Selenium_workspace\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.seleniumhq.org/download/");
}
}
我认为您的chromedriver
没有放置在您定义的路径中"C:Sujata_Selenium_workspacechromedriver.exe"
将chromedriver
放在路径中或将其放置在 D 或 E 驱动器中的某个位置,例如
D:/Selenium/chromedriver.exe
代码类似
System.setProperty("webdriver.chrome.driver", "D:/Selenium/chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.seleniumhq.org/download/");