Java 对于Selenium WebDriver中的ChromeDriverService类型,未定义使用ChromeDriverExecutable(File)的方法

Java 对于Selenium WebDriver中的ChromeDriverService类型,未定义使用ChromeDriverExecutable(File)的方法,java,google-chrome,selenium-webdriver,selenium-chromedriver,Java,Google Chrome,Selenium Webdriver,Selenium Chromedriver,我的代码如下: ChromeDriverService service = new ChromeDriverService.Builder() .usingChromeDriverExecutable(new File("E:\\Software\\chromedriver.exe")) .usingAnyFreePort().build(); 它给出了以下错误: The method usingChromeDriverExecutable(File) is undefined fo

我的代码如下:

  ChromeDriverService service = new ChromeDriverService.Builder()
 .usingChromeDriverExecutable(new File("E:\\Software\\chromedriver.exe"))
 .usingAnyFreePort().build();
它给出了以下错误:

 The method usingChromeDriverExecutable(File) is undefined for the type
 ChromeDriverService
改变

usingChromeDriverExecutable

改变

usingChromeDriverExecutable


我在代码中没有使用该方法。我使用了以下简单的代码&运行良好。File File=新文件(“F:\\Software Download\u Ripon\\WebDriver\\chromedriver\u win\u 22\u 0\u 1203\u 0b\\chromedriver.exe”)//v22 System.setProperty(“webdriver.chrome.driver”,file.getAbsolutePath());驱动程序=新的ChromeDriver();我们可以指定指向驱动程序可执行目录位置的path环境变量,而不是指定驱动程序可执行路径。我在代码中没有使用该方法。我使用了以下简单的代码&运行良好。File File=新文件(“F:\\Software Download\u Ripon\\WebDriver\\chromedriver\u win\u 22\u 0\u 1203\u 0b\\chromedriver.exe”)//v22 System.setProperty(“webdriver.chrome.driver”,file.getAbsolutePath());驱动程序=新的ChromeDriver();我们可以指定指向驱动程序可执行目录位置的path环境变量,而不是指定驱动程序可执行路径