2

I was running some quick tests using WebDriver. I downlowded the FirefoxWebDriver and the ChromeWebDriver; geckodriver-v0.10.0-win64.zip and chromedriver_win32.zip.

They are extracted to a path location and have been renamed accordingly; wires.exe and chromedriver.exe respectively.

When I created my test, did as follows:

DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(cap);

//WebDriver driver = new ChromeDriver(DeesiredCapabilities.chrome());

and for Firefox, it failed to create a session (and failed the tests), where-as chrome succeeded and then passed the tests.

The Output from the test is as follows:

Sep 28, 2016 2:51:32 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Sep 28, 2016 2:51:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
Sep 28, 2016 2:51:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.

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: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:57:44 -0700'
System info: host: 'CHI-CS-55DXX52', ip: '10.60.68.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: FirefoxDriver

 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618)
 at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
 at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
 at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:231)
 at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:219)
 at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:214)
 at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:131)
 at com.polymerdart.webdriver.MyFirstTest.startWebDriver(MyFirstTest.java:21)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
 at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
 at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
 at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
 at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
 at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: 'unknown', revision: 'c7b525d', time: '2016-09-01 14:57:44 -0700'
System info: host: 'CHI-CS-55DXX52', ip: '10.60.68.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_77'
Driver info: driver.version: FirefoxDriver
 at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80)
 at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
 at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:597)
 ... 34 more

I do see Firefox opening, but it just fails to create the session and the closes. I am currently running on this machine Firefox version 41.0

Louis
  • 146,715
  • 28
  • 274
  • 320
Fallenreaper
  • 10,222
  • 12
  • 66
  • 129
  • Try as `WebDriver driver = new MarionetteDriver(cap);` instead and let me know – Saurabh Gaur Sep 28 '16 at 19:21
  • @SaurabhGaur It says "unreachable browser exception" Maybe that is because I updated the filename of the updated firefox from gecko to wires. As a side note, IntelliJ says the MarionetteDriver is depricated. – Fallenreaper Sep 28 '16 at 19:28
  • Which version of selenium and Firefox are you using?? – Saurabh Gaur Sep 28 '16 at 19:30
  • Firefox 41, Selenium 3.0.0-beta3 – Fallenreaper Sep 28 '16 at 19:31
  • Ah, thats is the problem, actually latest selenium support geckodriver to launch firefox, and geckodriver support only >= v47 of firefox version, so you need to upgrade your firefox browser as well or downgrade selenium version to `selenium2`. Thank – Saurabh Gaur Sep 28 '16 at 19:36
  • So if i want to test on various versions of Firefox, i will have to have different versions of selenium running different tests? That kinda weird. – Fallenreaper Sep 28 '16 at 19:38
  • Yeah you're right, it's weird but this is happened after Mozilla provided executable geckodriver to support latest firefox with selenium just like other driver. Thank – Saurabh Gaur Sep 28 '16 at 19:44
  • I am doing some tests to confirm that the Firefox update to >= 47 is the answer. I will post a confirmation or new info shortly. – Fallenreaper Sep 28 '16 at 19:47
  • Confirmed. Mozilla Firefox v47.1 works with Selenium 3.0.0-beta3, BUT it doesnt work with 3 line the code snippet I supplied in the question. Now you just need `WebDriver driver = new WebDriver(DesiredCapabilities.firefox());` – Fallenreaper Sep 28 '16 at 19:49
  • Nothing do special with selenium 3 after upgrading firefox just simply call `new FirefoxDriver()` after setting system property with geckodriver driver as suggested answer and it would work. Thanks – Saurabh Gaur Sep 28 '16 at 20:00

1 Answers1

4

This is the incapability issue between Selenium3 and Mozilla Firefox version.

Actually Selenium3 supports executable geckodriver to launch Mozilla Firefox just like other driver now but executable geckodriver compatible with Mozilla Firefox >= v47, that's why you're in trouble.

There are two work around to get rid from this issue :-

  • Downgrade your selenium version to Selenium2 as well.

  • Upgrade your Mozilla Firefox >= v47 as well and try with Selenium3 and launching FirefoxDriver as below :-

    //Set system property with downloaded executable geckodriver from your system location 
    
    DesiredCapabilities cap = DesiredCapabilities.firefox();
    cap.setCapability("marionette", true);
    WebDriver driver = new FirefoxDriver(cap);
    
Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
  • 1
    When doing tests right now, doing it without `DesiredCapabilities.firefox()` will cause it to fail for me. Just so you know. I kept it in there. – Fallenreaper Sep 28 '16 at 20:42
  • 1
    It also works directly `System.setProperty("webdriver.gecko.driver","path of geckodriver.exe"); WebDriver driver = new FirefoxDriver();` – Chandra Shekhar Sep 29 '16 at 10:27