java.lang.IllegalStateException "main"线程中的异常:驱动程序可执行文件不存在:C:\Sujata_Selenium_workspace\chromed



>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/");

相关内容

最新更新