Question

I am unable to launch Firefox - with selenium 2.41 (only with this version)

This is how i invoke..

WebDriver d = new FirefoxDriver();
d.get("https://www.google.com");

getting below exception..

java.lang.NoSuchMethodError: org.openqa.selenium.Proxy.extractFrom(Lorg/openqa/selenium/Capabilities;)Lorg/openqa/selenium/Proxy;
at org.openqa.selenium.firefox.FirefoxDriver.dropCapabilities(FirefoxDriver.java:313)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:192)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at com.qglobal.automation.utility.convertt.main(convertt.java:103)

any idea??

EDIT

I just found out that it happens if i had associated selendroid-standalone-0.8.0-with-dependencies.jar (i need this for running my tests in android). If i remove this jar, then the above exception does not occur.

how can i have both jars in my test? any idea?

(Issue is found only in Firefox. Chrome is working fine.)

Was it helpful?

Solution 4

The issue is resolved.

I had selendroid jar as well associated to the test(which is used to run my tests in Android devices). Due to the order of the jars in the classpath, selendroid jar was causing the issue. When i changed the order (selenium jar first , selendroid next), error is gone.

Thank You All.

OTHER TIPS

I was lucky enough to get the solution for the same issue in a jiffy. With suggestions from "vlns" and "user1825477"'s answer, first I checked the version for selenium-api in my pom.xml file, it was indeed 2.40 changed it to 2.41. Removed all the External jar's and Maven Dependencies, and re-ran the pom file as Maven Build. Once all the Maven dependencies were involved, carefully added the jar files individually back by cross verifying the exact version, by cross verifying I mean, I basically took the latest version of all the jars, I had a couple of them with lower version so changed them.

I guess spending a small amount of time in properly selecting the jars is a great idea.

I ran into this issue myself, using Maven. Seems like the core issue is that in 2.41+, the Proxy.java class used by Firefox driver has a new method extractFrom that is not present in the previous version. The dependencies for some third party drivers was forcing the older version of the selenium-api package, which contains Proxy.java.

One has to either add exclusions to the third party dependencies for selenium-api resolve it, or explicitly add selenium-api to the dependency list and specify it at version 2.41.

  • Check whether the Selenium JAR is present in your classpath when you launch your java program. NoSuchMethod errors could potentially mean problems with classpath.
  • if using driver 2.41 is not critical, try downgrading to a lower version. In my experience this doesn't make a difference (unless there are features you are specifically looking for in v2.41)

Adding the following to pom.xml fixed the issue for me

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.47.1</version>
    </dependency>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top