<span style="font-size: 12px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">背景:从github获得项目,首次运行时,提示错误:</span><span style="font-family: arial, sans-serif; font-size: 17.27272605896px; background-color: rgb(221, 221, 221);"><strong>java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal</strong></span>
原因:
I found out that it is the apache poi-ooxml 3.9 jar that I'm using for processing xlsx files which caused the issue. When building using Maven, it is pulling in the xml-apis jar 1.0.b2 which is not compatible with the new selenium version. My current work around is to exclude the xml-apis jars from the poi dependency.
大意是poi-ooxml的版本导致的,maven下载下来的版本不适用于当前selenium
解决方法:把poi-ooxml排除掉
<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.9</version> <exclusions> <exclusion> <artifactId>xml-apis</artifactId> <groupId>xml-apis</groupId> </exclusion> </exclusions> </dependency>
原文:https://code.google.com/p/selenium/issues/detail?id=5245