0

I have been trying to solve this issue, but I've had no luck in the past 3 hours. All I need now is using Selenium to open website in Chrome, but it just doesn't work. I tried using GeckoDriver, too, but it just throws a different kind of exception. All software involved are up-to-date. I even tried disabling my WiFi and using cellular data (I thought the connection was blocked by the firewall), but it doesn't work, either. If someone can help me I will be really appreciated! I have seen some similar questions on stackoverflow, but none of the answers work.

Here's my code:

package bot;

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

public class Terminator {
    public static void main(String[] aaaa)  {
        System.setProperty("webdriver.chrome.driver", "/Users/myName/Documents/chromedriver");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.google.com");
    }
}

And this is the runtime exception thrown:

Starting ChromeDriver 2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 22038 Only local connections are allowed. Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z' System info: host: 'myName-MacBook-Air.local', ip: 'fe80:0:0:0:14b0:2df0:4281:99d%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.2', java.version: '1.8.0_65' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) 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 bot.Terminator.main(Terminator.java:10) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:22038/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(DriverService.java:187) ... 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:147) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 10 more

Azeem
  • 11,148
  • 4
  • 27
  • 40
Ptolemorphism
  • 101
  • 2
  • 11
  • "All software involved are up-to-date" is not good enough. What are the actual version numbers for Selenium, Chrome, and ChromeDriver? – SiKing Oct 16 '18 at 19:04
  • @Navarasu My question was asked on Jan.19. That question was asked yesterday – Ptolemorphism Oct 16 '18 at 21:22
  • Hmm Yes I am aware. I just started my account a week back and anwsering recent quesion. I found this related to it in suggection. As it is earlier, I have added it as comment here to reach the answer to you. @SiKing in the comment asked to flag this question. I didn't understand how to handle this? :( – Navarasu Oct 16 '18 at 21:45
  • @Navarasu Please see this answer on meta: https://meta.stackoverflow.com/a/252017/3124333 Flagging this as a duplicate is fine. – SiKing Oct 16 '18 at 23:56
  • @Navarasu It’s ok. I don’t think it really matters that much – Ptolemorphism Oct 16 '18 at 23:58

1 Answers1

0

It may be either the Chrome Driver does not started or localhost hostname is not accesible.

Please read this answer for debugging steps.

Navarasu
  • 8,209
  • 2
  • 21
  • 32