【问题标题】:When using "new FirefoxDriver()" I am always getting a "NoSuchMethodError: org.apache.xpath.XPathContext"使用“new FirefoxDriver()”时,我总是收到“NoSuchMethodError: org.apache.xpath.XPathContext”
【发布时间】:2013-12-23 19:20:00
【问题描述】:

当使用new FirefoxDriver() 时,我总是得到一个

NoSuchMethodError: org.apache.xpath.XPathContext

(线程“主”java.lang.NoSuchMethodError 中的异常: org.apache.xpath.XPathContext.(Z)V 在 org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:115) 在 org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:99) 在 org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:184) 在 org.openqa.selenium.firefox.internal.FileExtension.readIdFromInstallRdf(FileExtension.java:120) 在 org.openqa.selenium.firefox.internal.FileExtension.writeTo(FileExtension.java:60) 在 org.openqa.selenium.firefox.internal.ClasspathExtension.writeTo(ClasspathExtension.java:63) 在 org.openqa.selenium.firefox.FirefoxProfile.installExtensions(FirefoxProfile.java:464) 在 org.openqa.selenium.firefox.FirefoxProfile.layoutOnDisk(FirefoxProfile.java:442) 在 org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:79) 在 org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:250) 在 org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110) 在 org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:195) 在 org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190) 在 org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:107) 在 test.PerfTest.main(PerfTest.java:35) )

【问题讨论】:

    标签: selenium xpath selenium-webdriver nosuchmethoderror selenium-firefoxdriver


    【解决方案1】:

    这可能是xalan.jar 造成的。检查您的类路径中是否有不同版本的 xalan,并尝试检查 webdriver 是否引用了正确的 jar。你可以试试

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

    检查它正在使用哪个 jar。

    【讨论】:

    • 好皮卡 - 帮我剪掉了更多的头发并制作了另一个 Stackoverflow 帖子!
    猜你喜欢
    • 2018-10-04
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-22
    • 2020-03-14
    • 1970-01-01
    相关资源
    最近更新 更多