java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; (driver.get)

huangapple go评论130阅读模式
英文:

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; (driver.get)

问题

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.chrome.*;
class meet
{
    public static void main()
    {
        System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "/chromedriver");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--start-maximized");
        WebDriver driver = new ChromeDriver(options);
        driver.get("https://www.google.com");
    }
}
i am new to selenium please help
java.lang.IllegalStateException: The driver executable does not exist: C:\Users\piyush\Desktop\New folder\meet\meet\chromedriver
	at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
	at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:146)
	at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141)
	at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)
	at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159)
	at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355)
	at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
	at meet.main(meet.java:12)
英文:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.chrome.*;
class meet
{
    public static void main()
    {
        System.setProperty(&quot;webdriver.chrome.driver&quot;,System.getProperty(&quot;user.dir&quot;)+&quot;/chromedriver&quot;);
        ChromeOptions options = new ChromeOptions();
        options.addArguments(&quot;--start-maximized&quot;);
        WebDriver driver = new ChromeDriver(options);
        driver.get(&quot;https://www.google.com&quot;);
    }
}

i am new to selenium please help

java.lang.IllegalStateException: The driver executable does not exist: C:\Users\piyush\Desktop\New folder\meet\meet\chromedriver
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:146)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
at meet.main(meet.java:12)

答案1

得分: 0

属性名称应为 webdriver.chrome.driver,而不是 webdrivers.chrome.driver

英文:

Property name is webdriver.chrome.driver not webdrivers.chrome.driver

答案2

得分: 0

请同时添加扩展名。应该是Chromedriver.exe。

英文:

please add the extension as well. It should be Chromedriver.exe

huangapple
  • 本文由 发表于 2020年8月7日 17:49:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/63299297.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定