1
org.openqa.selenium.TimeoutException: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'ubuntu', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-112-generic', java.version: '11.0.8'
Driver info: driver.version: FirefoxDriver

I am trying to connect to a website using selenium, when I test this on my PC it works fine, but when I run it on a server it throws this error...

Code:

        System.out.println(1);
        System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setHeadless(true);
        java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
        System.out.println(1);
        WebDriver driver = new FirefoxDriver(firefoxOptions);
        System.out.println("starting...");
        try (AutoCloseable autoCloseable = () -> driver.close()) {
            driver.get("https://website.com");
            System.out.println(1);
            ....

Output:

1
1
1595767726383   mozrunner::runner       INFO    Running command: "/usr/lib/firefox/firefox" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/tmp/rust$
*** You are running in headless mode.

for some reason this is not making it to the try-with-resource block, can someone shine some light on this?

(From what I know so far its stuck on the WebDriver initialisation)

EDIT: I read the thread Selenium stuck on WebDriver object and it did not provide any assistance as my Java version is already using 1.8.

Aasil
  • 103
  • 5

0 Answers0