Marionette Driver Unreachable exception

2019-07-30 08:45发布

I am using Firefox 47.0.1 with Marionette driver geckodriver-v0.8.0-win32. But I got unreachable browser exception and firefox not opening.

My code snippet looks like below :

System.setProperty("webdriver.gecko.driver", "C:/Documents and Settings/Admin/Desktop/wires-0.6.2-win/wires.exe");
GeckoDriverService service = new GeckoDriverService(new File("C:/Documents and Settings/Admin/Desktop/wires-0.6.2-win/wires.exe"), PortProber.findFreePort(), null, null);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
cap.setCapability("firefox_binary", "G:/Program Files/Mozilla Firefox/firefox.exe");
driver = new MarionetteDriver(service, cap,PortProber.findFreePort());

showing exception as :-

org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40' System info: host: 'computer_1', ip: '192.168.1.100', os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.7.0_79' Driver info: driver.version: MarionetteDriver

2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-30 08:55

I'm assuming, you are using selenium 3.0 beta2. Here is the solution:

System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe"); //change geckodriver path accordingly.
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
webDriver = new MarionetteDriver(capabilities);

Please download latest geckodriver from https://github.com/mozilla/geckodriver/releases.

查看更多
forever°为你锁心
3楼-- · 2019-07-30 09:11

There is no need for renaming geckodriver.exe to wires.exe. And usage of GeckoDriverService is not needed. With the stable release they've simplified the coding. Just download GeckoDriver and use it like

    System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe");
    DesiredCapabilities caps = DesiredCapabilities.firefox();
    caps.setCapability(FirefoxDriver.BINARY, "G:\\Program Files\\Mozilla Firefox\\firefox.exe");
    WebDriver driver = new MarionetteDriver(caps);
查看更多
登录 后发表回答