简体   繁体   中英

Selenium in Chrome browser shows Exception in thread “main” org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start

Hell0, I am new to Selenium. I have installed selenium and was writing my first code. I am getting the following error


Starting ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}) on port 46362 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: host: 'DESKTOP-LCJO8BB', ip: '192.168.1.8', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.startSession(Remot eWebDriver.java:213) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at seleniumPackage.SeleniumClass.main(SeleniumClass.java:12) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:46362/status] to be available after 20005 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(Driver Service.java:197)... 9 more Caused by: java.util.concurrent.TimeoutException at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204) at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)... 10 more

My Code



import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class SeleniumClass {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "F:\\Selenium\\Jars and Drivers\\Drivers\\Chrome\\chromedriver_win32\\chromedriver.exe");
        //System.setProperty("webdriver.gecko.driver", "F:/Selenium/Jars and Drivers/Drivers/Firefox/geckodriver-v0.29.0-win64/geckodriver.exe");
        WebDriver driver = new ChromeDriver();
        //WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");
    }

}````

Could you please assist here.

Thanks,
Jisha
code is correct. added code for time out exception. implicitlyWait added
public class SeleniumClass {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "C:\\\\Drivers\\\\chromedriver.exe");
        //System.setProperty("webdriver.gecko.driver", "F:/Selenium/Jars and Drivers/Drivers/Firefox/geckodriver-v0.29.0-win64/geckodriver.exe");
        WebDriver driver = new ChromeDriver();
        //WebDriver driver = new FirefoxDriver();
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
        driver.get("http://www.google.com");
    }

}

https://sites.google.com/a/chromium.org/chromedriver/

try - I downloaded latest stable version and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM