1

I am unable to enter the URL in the chrome browser as currently the browser is getting opened but the URL is not getting entered automatically. Their is some issue of browser probably.

The code is:

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;


public class OpenBidAssist {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
        System.out.println("TEST1");
        WebDriver driver=new ChromeDriver();
        WebDriverWait wait=new WebDriverWait(driver, 20);
        System.out.println("TEST2");
        driver.get("https://stg-cipher-fe.ofbusiness.in/");
        System.out.println("TEST3");
    }
}

The Error i am getting is:

TEST1
Created new window in existing browser session.
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: 'ofbl219-Latitude-3480', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-49-generic', java.version: '1.8.0_181'
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(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
    at OpenBidAssist.main(OpenBidAssist.java:13)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:11320/status] to be available after 20006 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
    ... 9 more
Caused by: java.util.concurrent.TimeoutException
    at java.util.concurrent.FutureTask.get(FutureTask.java:205)
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
    ... 10 more

Can anyone help me in it. Thanks in advance,

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
RAHUL
  • 398
  • 1
  • 6
  • 15

4 Answers4

2

replace System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");

with the path of exe file like System.setProperty("webdriver.chrome.driver", "your path of Driver/chromedriver.exe");

Waqar Nadir
  • 378
  • 2
  • 9
  • New Code:- public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "/opt/google/chrome/google-chrome"); WebDriver driver=new ChromeDriver(); System.out.println("TEST2"); driver.get("https://stg-cipher-fe.ofbusiness.in/"); } } Error:- "Failed to set referrer policy: The value 'strict-origin' is not one of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-crossorigin', or 'unsafe-url'. The referrer policy has been left unchanged.", source: https://www.google.com/_/chrome/newtab?espv=2&ie=UTF-8 – RAHUL Mar 08 '19 at 08:11
2

This error message...

Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

...implies that your program was unable to initiate/spawn a new WebDriver i.e. ChromeDriver process.

Your main issue is the Value you have passed to the System.setProperty() line.

Instead of the absolute path of the Google Chrome client binary, you need to pass the absolute path of the ChromeDriver. So you need to:

  • Change:

    "/usr/bin/google-chrome"
    
  • With:

    "/path/to/chromedriver"
    

Essentially, you need to:

  • Change:

    System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
    
  • With:

    System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
    

Note: You can download the relevant version of ChromeDriver from ChromeDriver - WebDriver for Chrome

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

It is very clear from your code that you are trying to create ChromeDriver but the path to the executable is not correct.

Download the latest ChromeDriver executable from the chromedriver downloads

Then replace the

System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");

with

System.setProperty("webdriver.chrome.driver", "/path to chromedriver/chromedriver.exe");

0

We spent an extraordinary amount of time figuring out why we got this exact error on the build servers but not on the developer stations. You can get this error when Chrome is not installed. The path to the ChromeDriver.exe can be perfect but you will still get this error if you don't also have Chrome. When you run ChromeDriver.exe manually it will start up and be responsive without Chrome installed, you can query it at http://localhost:9515/status but it still won't work under test.

DavesPlanet
  • 576
  • 5
  • 14