kirschmichel
kirschmichel

Reputation: 923

Failed to connect to binary FirefoxBinary with Selenium in Maven

I am running some Selenium-Tests. When I start them directly from Eclipse everything works fine. But when I Start them through Maven there the following Exception occurs:

org.openqa.selenium.WebDriverException(Failed to connect to binary FirefoxBinary(C:\winapp\Firefox\firefox.exe) on port 7055; process output follows: 
null
Build info: version: '2.26.0', revision: '18040', time: '2012-11-02 09:44:45'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35'
Driver info: driver.version: FirefoxDriver)

I am using Firefox 10.0.10 ESR. I have also tried it with Selenium 2.25.0.

Here is my latest version of the pom.xml:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.26.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.26.0</version>
        <exclusions>
            <exclusion>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.1</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.jdom</groupId>
        <artifactId>jdom2</artifactId>
        <version>2.0.3</version>
    </dependency>
</dependencies>

If I can support you with more information, please let me know.

edit: updated pom.xml

edit2: What wonders me most, is that i can run the tests from eclipse without ans problems. they just occure, if i call "mvn install" for example

Upvotes: 33

Views: 65671

Answers (11)

jyoti singh
jyoti singh

Reputation: 1

Try using the latest selenium server version, You need to check the compatibility between browser and selenium server.

    <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
    </dependency> 

Upvotes: 0

ABDUL IMRAN
ABDUL IMRAN

Reputation: 1

my recommendation is 

    ===> switch to firefox version 50.0 [latest One] , 

    ===> download the gecko driver from [.](https://github.com/mozilla/geckodriver/releases)  and 

    ===> Selenium version 3.0.1
     <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>3.0.1</version>
     </dependency>

    ==> On your Code 
private WebDriver driver;
System.setProperty("webdriver.gecko.driver", "PATH to GECKO DRIVER");
        driver = new FirefoxDriver();

    and yes you see the below output in your console :


    Dec 17, 2016 6:40:45 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
    14819XXXXXXX5   mozprofile::profile INFO    Using profile path C:\Users\User\AppData\Local\XXXXX\rust_XXXprofile.OXXXXXXXXXXX7S
    148XXXXXXXXX0   geckodriver::marionette INFO    Starting browser C:\Program Files\Mozilla Firefox\firefox.exe
    148XXXXXXXXX1   geckodriver::marionette INFO    Connecting to Marionette on localhost:XXXXXXX
    148198XXXX077   Marionette  INFO    Listening on port 53532
    Dec 17, 2016 6:40:55 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: W3C
    [Child 4104] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line XXXX
    Dec 17, 2016 6:41:13 PM org.openqa.selenium.os.UnixProcess destroy

Upvotes: 0

Abhishek_Mishra
Abhishek_Mishra

Reputation: 4621

Trying Adding this to your pom

UPDATED:

<dependency>
    <groupId>org.seleniumhq.webdriver</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>2.XX.X</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>2.XX.X</version>
</dependency> 

Upvotes: 3

rs79
rs79

Reputation: 2321

After battling this for a while and trying most (if not all) of the options listed here, I finally got rid of this error by removing an unused JAR - ios-server-0.6.5-jar-with-dependencies.jar in my build path, and using a combination of FF34 and selenium jars 2.48.2.

Just wanted to post this as another option in case any one runs into this debilitating issue.

Upvotes: 0

Wendy Hu
Wendy Hu

Reputation: 1

Cannot find the firefoxbinary path. Please set the firefox path in advance of using firefox driver.

System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");

Upvotes: -1

Tarek Radwan
Tarek Radwan

Reputation: 23

I had this issue with Firefox 36, also people were facing the same in 35 and 44.

For conclusion, upgrade your Firefox to 37 or downgrade it to anything less than 33.

Upvotes: 0

Lexuslll
Lexuslll

Reputation: 9

The same problem also occures when there is no left space on disk where your Firefox cache folder located. Just free the space and launch your scripts!

Upvotes: -2

Eric Klumpp
Eric Klumpp

Reputation: 21

We had a similar problem that appeared after Linux updates. We tested lots of combination of selenium versions (2.42.2 and 2.43.1) and firefox (27.0.1 to 32.0.2), but the problem was always present.

We are under OpenMandriva, and the project is under Eclipse and Maven.

We found a solution for us, that was to replace following maven dependency

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.43.1</version>
    </dependency>   

by all of following ones :

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.43.1</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>2.43.1</version>
    </dependency>   

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>2.43.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.5</version>
    </dependency>

I wonder if this solution is only hiding the real problem ?

Upvotes: 1

Rajesh J Advani
Rajesh J Advani

Reputation: 5710

If you've updated both Firefox and Selenium to the latest versions in trying to fix this issue, and you are still facing the problem, you may have updated Firefox using "Restart to update".

Shutdown Firefox and ensure that the Firefox executable is no longer running. Then try your test. It should work now.

I'm guessing this is related to when exactly the Firefox binary is updated when you use "Restart to Update"

Upvotes: 0

kirschmichel
kirschmichel

Reputation: 923

I figured out where the problem was.

I loaded some extensions to add to the FirefoxProfile I use to instantiate the FireFoxDriver. These plugins where located under Java/main/resources. In Eclipse everything worked fine, but I couldn't access these plugins through Maven. After copying these files to a temporary folder, and load them from there it worked even from Maven.

Thanks for your Help

Upvotes: 5

Matthew Petty
Matthew Petty

Reputation: 652

When I encounter this error it's usually one of two things.

The Selenium version does not support the browser version Double check the Selenium/browser versions are the same when ran from Eclipse vs Maven. Double check Eclipse and Maven are configured to use the same Selenium version. This occurred for me when my browser auto updates so I turned that off in the browser.

The Selenium tests are running in headless mode Unlikely if your manually executing mvn on the same machine as Eclipse. This occurred for me when running Selenium through Maven on my Jenkins server. The Jenkins server was running in headless mode. Took me minute to figure out the headless stuff, think I set a DISPLAY env variable in Linux or something.

Upvotes: 30

Related Questions