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

前端 未结 10 1610
攒了一身酷
攒了一身酷 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 12:11

    Try:

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;
    
    public class Demo2 {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
    
            System.setProperty("webdriver.chrome.driver", "I:\\Bhasker-ShiroCode\\work\\chromedriver.exe");
    
            WebDriver driver = new ChromeDriver();
    
            driver.get("http://google.com");
        }
    
    }
    

    To avoid Error:

    • webdriver.chrome.driver ( should be in small letters )
    • have to give correct chromedriver.exe ( correct path )
    • Import all Selenium jars under class Path

提交回复
热议问题