Getting “The path to the driver executable must be set by the webdriver.chrome.driver system property”though set correct path

前端 未结 10 1623
攒了一身酷
攒了一身酷 2020-12-10 11:30

My code is very simple code:

WebDriver wd =new ChromeDriver();
  System.setProperty("webdriver.chrome.driver",
                     "D:\\\\List         


        
10条回答
  •  情歌与酒
    2020-12-10 11:57

    If you are using IntelliJ IDE, then on IntelliJ without setting up within the 'Run > Edit configurations > VM Options' i will just meet this error:

    Failed scenarios:
    C:/Users/DATestAdmin/IdeaProjects/TestLogin/src/test/resources/login.feature:4 # Scenario: Successfully logging in
    
    1 Scenarios (1 failed)
    3 Steps (3 skipped)
    0m0.194s
    
    java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property;
    

    So once i've added the path to my chromedriver locally in 'Run > Edit configurations > VM Options':

    -Dwebdriver.chrome.driver="C:\\Users\\This\\Is\\Where\\ChromeDriverIs\\chromedriver_win32.exe"
    

    Run > Edit Configurations

    I'm now able to launch my Chrome browser successfully.

提交回复
热议问题