0

I have read the similar question on SO however no answer was posted in addition my error does seem to be different in detail.

When I run

package seleniumPrograms;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Gecko_Driver {
    public static void main(String[] args)  {

        System.setProperty("webdriver.gecko.driver", "C:\\Program 
        Files\\Drivers\\geckodriver-v0.16.1-win64\\geckodriver.exe");
        DesiredCapabilities capabilities=DesiredCapabilities.firefox();
        capabilities.setCapability("marionette", true);
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");
        driver.manage().window().maximize();  
        driver.quit();
    }
}

I'm Getting following Error :

1495603278185 geckodriver INFO Listening on 127.0.0.1:25555 1495603278690 geckodriver::marionette INFO Starting browser \?\C:\Program Files\Mozilla Firefox\firefox.exe with args ["-marionette"] Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Failed to start browser \?\C:\Program Files\Mozilla Firefox\firefox.exe: other os error Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'LT9LTDRC2', ip: '172.22.1.111', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131' Driver info: driver.version: Gecko_Driver remote stacktrace: stack backtrace: 0: 0x489f6f -
1: 0x48ad59 - 2: 0x43a15d - 3: 0x43f982 - 4: 0x443f9a - 5: 0x41ddb1 - 6: 0x4091c7 - 7: 0x6bc939 - 8: 0x415a19 - 9: 0x6b6e43 - 10: 0x7ff9512c8364 - BaseThreadInitThunk at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$22(ProtocolHandshake.java:365) at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source) at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.findFirst(Unknown Source) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:368) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:159) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:104) at seleniumPrograms.Gecko_Driver.main(Gecko_Driver.java:13)

I am running on Selenium 3.4.0, Gecko 0.16.1 and FF 53.0.3 so I don't think its a version issue. I am guessing it could be the \\?\C section where it is looking for the browser.

bowja
  • 101
  • 1
  • 2
  • 12
  • can you remove these ` DesiredCapabilities capabilities=DesiredCapabilities.firefox(); capabilities.setCapability("marionette", true);` and try – Trimantra Software Solution May 24 '17 at 05:57
  • 1
    Duplicate of OP's own Question https://stackoverflow.com/questions/44060582/java-selenium-webdriver-connection-refused where OP is aware `Our security dept introduced a policy which blocked access to the execution of the geckodriver.exe. This was identified by attempting to run from cmd. Not sure why I didn't get the meaningful error in the IDE (blocked by group policy) for gecko, I did get this error for chrome and IE. In order to use the driver it needed to be saved in Program files though this may be specific to my situation.` – undetected Selenium May 24 '17 at 06:51
  • Thanks @TrimantraSoftwareSolution I tried your solution but the outcome was the same. Dev this issue is different even though the same code causes it. The error log is different. Previously I needed to save the webdriver in a particular directory to avoid a connection refused error. This is a failed to start browser error which occurs after the webdriver starts listening. Had I known to check via command line for a group policy error with my previous issue it would have saved me a lot of time. This is why I answered my own question. – bowja May 24 '17 at 10:36

1 Answers1

0

It's been a while since this problem has been reported, but it would be good to get it finally answered. Basically what was happening here was a bug in geckodriver, which I fixed for the 0.17 release. So specifically this failure should not be present anymore since this version got released.

Henrik
  • 249
  • 1
  • 6