Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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) )

like image 796
Tester Avatar asked Oct 21 '22 19:10

Tester


1 Answers

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.

like image 52
Erki M. Avatar answered Oct 28 '22 21:10

Erki M.