Geckodriver.exe? "Could not start a new session."

1,743 views
Skip to first unread message

rubi...@gmail.com

unread,
Aug 19, 2016, 9:27:26 PM8/19/16
to PrimaTest Automation
We have recently upgraded to version 2.4. Everything worked fine after the upgrade. About two weeks ago, we started getting the following error:

"The path to the driver executable must be set by the webdriver.gecko.driver system property"

Why would it all of a sudden start asking for geckodriver if it wasn't needed before? We haven't changed anything on the server or test machines. Test machines are running FF 46.0.1 on Windows 8.1. Trying to get to the bottom, we downloaded geckodriver.exe and copied to the FF directory, also added the directory path to the path environment variable.

Now it throws the following error which we cant get past from:

"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: '31c43c8', time: '2016-08-02 21:57:56 -0700' System info: host: 'JR-win8-64-2', ip: '10.0.0.4', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_65' Driver info: driver.version: FirefoxDriver"

Cant even get the Amazon test project to run as it throws the same error. We have also tried on FF 44 and 48, same results. Any assistance would be greatly appreciated.

venkat....@gmail.com

unread,
Aug 23, 2016, 10:21:18 PM8/23/16
to PrimaTest Automation, rubi...@gmail.com


Hi,

I also experienced the same problem with my Firefox 46 and I solved it by modifying my ivy.xml

Upon googling, I understood that the latest version of Selenium needs an external .exe called gecko driver to interact with Firefox; this was the case for Selenium with other browsers such as Chrome & IE, but now its required for Firefox as well.

Fortunately, till Selenium 2.53 this was not the case, we can modify our ivy.xml file NOT to download latest version of the selenium like this -

<dependency org="org.seleniumhq.selenium" name="selenium-java" rev="2.53.1"/>
<dependency org="org.seleniumhq.selenium" name="selenium-server" rev="2.53.1"/>
<dependency org="org.seleniumhq.selenium" name="selenium-firefox-driver" rev="2.53.1"/>

NOTE:
1. This will only work with Firefox version still 46 and not beyond that.

2. I know the above solution is not an ideal one but solves the problem temporarily. The ideal solution would be to modify "Browser.groovy" script under Selenium source code in RedwoodHQ to pick up the gecko driver for Firefox. I am working on it and will post it once I find a solution.

Freddy Vega

unread,
Aug 31, 2016, 5:31:10 PM8/31/16
to PrimaTest Automation, rubi...@gmail.com, venkat....@gmail.com
Below is the  modification needed to Browser.groovy to work with the newer versions of Firefox using geckodriver.

The following imports are needed:
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

Then modify the firefox section:
    if (params."Browser Type" == "Firefox")
    {
          sBrowserName = "Firefox"
        System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
        FirefoxBinary binary = new FirefoxBinary(new File("C:/Program Files (x86)/Mozilla Firefox/firefox.exe")); // this should be the path to your firefox binary
        FirefoxProfile profile = new FirefoxProfile();
        Driver = new FirefoxDriver(binary, profile);
    }

Hope that helps.

rubi...@gmail.com

unread,
Sep 1, 2016, 9:57:05 AM9/1/16
to PrimaTest Automation, rubi...@gmail.com, venkat....@gmail.com
On Tuesday, August 23, 2016 at 10:21:18 PM UTC-4, venkat....@gmail.com wrote:

Thanks for your help! This got us moving again.

rubi...@gmail.com

unread,
Sep 1, 2016, 9:57:44 AM9/1/16
to PrimaTest Automation, rubi...@gmail.com, venkat....@gmail.com
Did you have to also upload geckodriver.exe to the bin folder under Scripts?

Freddy Vega

unread,
Sep 3, 2016, 9:21:40 AM9/3/16
to PrimaTest Automation, rubi...@gmail.com, venkat....@gmail.com
Sorry for the late reply, but yes obviously you'll need the geckodriver executable as well. Glad I was able to help.

tk...@redskytech.com

unread,
Jan 16, 2017, 4:01:36 PM1/16/17
to PrimaTest Automation, rubi...@gmail.com, venkat....@gmail.com
I'm still unable to get Firefox to work... I gotten past all the geckodriver errors, but now I'm getting this...

Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@1c6e83b, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@1c6e83b, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: &#39;3.0.1&#39;, revision: &#39;1969d75&#39;, time: &#39;2016-10-18 09:49:13 -0700&#39;
System info: host: &#39;DEV-WINUTIL4&#39;, ip: &#39;192.168.20.114&#39;, os.name: &#39;Windows Server 2012 R2&#39;, os.arch: &#39;x86&#39;, os.version: &#39;6.3&#39;, java.version: &#39;1.8.0_65&#39;
Driver info: driver.version: FirefoxDriver

Gregory Meyerkord

unread,
Mar 9, 2017, 11:17:46 AM3/9/17
to PrimaTest Automation, rubi...@gmail.com, venkat....@gmail.com, tk...@redskytech.com
The issue is related to the geckodriver architecture - 32bit vs 64bit

This fix is for RedwoodHQ 2.5
1) Download the latest geckodrivers here - https://github.com/mozilla/geckodriver/releases
 - Unzip and rename the files
  - geckodriver32v0_15_0.exe (Windows 32bit version)
  - geckodriver64v0_15_0.exe (Windows 64bit version)
  - geckodriverMacv0_15_0
  - geckodriverLinux64v0_15_0
  *Change the 0_15_0 to match the version of the driver you downloaded. If using a different naming convention be sure to update the Java in step 4.

2) Upload the renamed files to the bin directory
- Right Click on bin -> New -> Upload
- Navigate to the location of each file, select the renamed file and click Open

3) Add the following dependency to ivy.xml
<dependency org="org.seleniumhq.selenium" name="selenium-support" rev="latest.release"/>


4) Modify the Firefox conditional statement in Browser.groovy (located in src -> actions -> selenium)

if (params."Browser Type" == "Firefox"){



 
if(os.contains("nix") || os.contains("nux")|| os.contains("aix")){ //tested on Linux Mint
 
System.setProperty("webdriver.gecko.driver", "geckodriverLinux64v0_15_0")
 
new File("geckodriverLinux64v0_15_0").setExecutable(true)
 
FirefoxBinary binary = new FirefoxBinary(new File("/usr/bin/firefox"))

 
FirefoxProfile profile = new FirefoxProfile()
 
Driver = new FirefoxDriver(binary, profile)



 
} else if(os.contains("mac")){ //tested on macOS 10.12.3
 
System.setProperty("webdriver.gecko.driver", "geckodriverMacv0_15_0")
 
new File("geckodriverMacv0_15_0").setExecutable(true)
 
FirefoxBinary binary = new FirefoxBinary(new File("/Applications/Firefox.app/Contents/MacOS/firefox"))

 
FirefoxProfile profile = new FirefoxProfile()
 
Driver = new FirefoxDriver(binary, profile)



 
} else {
 
String arch = System.getenv("PROCESSOR_ARCHITECTURE");
 
String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");
 
String realArch = arch.endsWith("64") || wow64Arch != null && wow64Arch.endsWith("64") ? "64" : "32"; //this is where the magic happens
 
 
if (realArch.contains("32")) { //tested on Windows 10 32-bit
 
System.setProperty("webdriver.gecko.driver", "geckodriver32v0_15_0.exe")
 
FirefoxBinary binary = new FirefoxBinary(new File("C:/Program Files/Mozilla Firefox/firefox.exe"))
 
} else { //tested on Windows 2012 64-bit
 
System.setProperty("webdriver.gecko.driver", "geckodriver64v0_15_0.exe")

 
FirefoxBinary binary = new FirefoxBinary(new File("C:/Program Files (x86)/Mozilla Firefox/firefox.exe"))
 
}

 
FirefoxProfile profile = new FirefoxProfile()
 
Driver = new FirefoxDriver(binary, profile)
 
}
}


5) Save, build, and push the changes

The above code isn't pretty but it works. I tried refactoring to have one profile and driver declaration but that didn't work on Linux and Mac. I'll tweak it a little more and post an update. My intention is to add similar functionality to the Chrome section and extend support for other browsers.
Reply all
Reply to author
Forward
0 new messages