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

前端 未结 10 1633
攒了一身酷
攒了一身酷 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:15

    The below lines works fine

    public class TestNGFile {
    
        public String baseUrl = "https://google.com";
        String driverPath = "C:\\\\Users\\\\Documents\\\\selenium\\\\chromedriver_win32\\\\chromedriver.exe";
        @Test
        public void verifyHomepageTitle() {
    
            System.out.println("launching chrome browser"); 
            System.setProperty("webdriver.chrome.driver", "C:\\Users\\Documents\\selenium\\chromedriver_win32\\chromedriver.exe");
            //System.setProperty("webdriver.gecko.driver", driverPath);
            WebDriver driver = new ChromeDriver();
            driver.get(baseUrl);
            String expectedTitle = "Google";
            String actualTitle = driver.getTitle();
            Assert.assertEquals(actualTitle, expectedTitle);
            driver.close();
    

提交回复
热议问题