When using "new FirefoxDriver()" I am always getting a "NoSuchMethodError: org.apache.xpath.XPathContext"

1.3k views Asked by At

When using new FirefoxDriver() I am always getting a

NoSuchMethodError: org.apache.xpath.XPathContext

(Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xpath.XPathContext.(Z)V at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:115) at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99) at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184) at org.openqa.selenium.firefox.internal.FileExtension.readIdFromInstallRdf(FileExtension.java:120) at org.openqa.selenium.firefox.internal.FileExtension.writeTo(FileExtension.java:60) at org.openqa.selenium.firefox.internal.ClasspathExtension.writeTo(ClasspathExtension.java:63) at org.openqa.selenium.firefox.FirefoxProfile.installExtensions(FirefoxProfile.java:464) at org.openqa.selenium.firefox.FirefoxProfile.layoutOnDisk(FirefoxProfile.java:442) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:79) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:250) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:195) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:107) at test.PerfTest.main(PerfTest.java:35) )

1

There are 1 answers

1
Erki M. On

It is probably xalan.jar causing this. Check if you have different versions of xalan in your classpath and try checking if webdriver is referencing the correct jar. You can try

System.out.println(new XPathContext().getClass().getProtectionDomain().getCodeSource().getLocation());

to check which jar it is using.