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:
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.
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 ?
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>
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.
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