Home > Enterprise >  Java selenium - timed out waiting for driver server to start
Java selenium - timed out waiting for driver server to start

Time:04-26

i need help , how to fix this bug , " timed out waiting for driver server to start "

enter image description here

i have tried many ways like changing google version and jdk version from 7 to 18 , change browser like firefox , microsoft Edge, google . I'm feeling helpless , i just want open a tab with selenium library

this is my code :

System.setProperty("webdriver.chrome.silentOutput", "true");
System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe");
WebDriver driver = new ChromeDriver();  // bug at here
driver.get("https://stackoverflow.com/");

what should i do to fix this ?

CodePudding user response:

At line#2, you have chrome.exe, is this Chrome browser or Chromedriver?

System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe");

You should be passing ChromeDriver.exe's path. You can download ChromeDriver from this link - https://chromedriver.chromium.org/downloads.

System.setProperty("webdriver.chrome.driver","Chromedriver path");

Alternatively, you can try to use WebDriverManager library - https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager

WebDriverManager.chromedriver().setup();

CodePudding user response:

Try use the following

System.setProperty("webdriver.chrome.driver","C:\\ProgramFiles\\Google\\Chrome\\Application\\chrome.exe");
  // Instantiate a ChromeDriver class.
        WebDriver driver = new ChromeDriver();
  
  // Maximize the browser
        driver.manage().window().maximize();
  
  // Launch Website
        driver.get("https://www.google.com/");

  • Related