Java Selenium org / openqa / selenium / Capabilities

时间:2017-08-23 13:29:41

标签: java selenium ant

我有硒和蚂蚁的问题。当我构建我的项目时,构建是成功的,但是当我想运行jar文件时,它失败了。

错误是:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/Capabilities
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)

我要添加到lib文件夹或build.xml?

我的build.xml:

<project>
<property name="app.name" value="Downloader"/>
<property name="dir.src" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>

<path id="classpath">
    <fileset dir="lib" includes="**/*.jar"/>
</path>



<pathconvert property="mf.classpath" pathsep=" ">
    <path refid="classpath"/>
    <mapper>
        <chainedmapper>
            <flattenmapper/>
            <globmapper from="*.jar" to="${lib.dir}/*.jar"/>
        </chainedmapper>
    </mapper>
</pathconvert>

<mkdir dir="build/classes"/>
<javac srcdir="src/" destdir="build/classes" debug="true" includeantruntime="true">
    <classpath>
        <path refid="classpath"/>
    </classpath>
</javac>

<target name="compile">
    <mkdir dir="build/classes"/>
    <javac srcdir="src/" destdir="build/" classpathref="classpath"/>
    <mkdir dir="app"/>
    <jar destfile="app/Downloader.jar" basedir="build/classes/">
        <manifest>
            <attribute name="Main-Class" value="downloader.Downloader"/>
            <attribute name="Class-Path" value="${mf.classpath}"/>
        </manifest>
    </jar>
</target>

<target name="clean">
    <delete dir="build"/>
    <delete dir="app"/>
</target>

和ls在我的lib文件夹中:

bundle-jars.jar
CGLIB的节点p-3.2.4.jar
客户端联合3.0.1-nodeps.jar
公地编解码器1.10.jar
公地EXEC-1.3.jar
公地IO-2.5.jar
公地lang3-3.4.jar
共享记录-1.2.jar
cssparser-0.9.20.jar
GSON-2.3.1.jar
番石榴19.0.jar
hamcrest核-1.3.jar
hamcrest库-1.3.jar
的HtmlUnit核心JS-2.23.jar
的HtmlUnit驱动器,2.23.jar
的HtmlUnit-2.23.jar
HttpClient的-4.5.2.jar
的HttpCore-4.4.4.jar
httpmime-4.5.2.jar
的javax.servlet-API-3.1.0.jar
jcip的注解-1.0.jar
jcommander-1.48.jar
码头-IO-9.2.13.v20150730.jar
码头-UTIL-9.2.13.v20150730.jar
JNA平台-4.1.0.jar
JNA-4.1.0.jar
基于JUnit 4.12.jar
猫-的HtmlUnit,2.23.jar
网状-3.5.7.Final.jar
phantomjsdriver-1.3.0.jar
SAC-1.3.jar
硒的API-3.0.1.jar
硒HTML的亚军3.0.1.jar
硒,铬司机3.0.1.jar
硒的Java-3.0.1.jar
硒 - 远程驾驶员3.0.1.jar
硒的服务器独立-3.0.1.jar
含硒载体-3.0.1.jar
硒-3.0.1-nodeps.jar
串行-2.7.2.jar
SLF4J-API 1.7.25.jar
SLF4J-简单1.7.25.jar
snakeyaml-1.15.jar
WebSocket的-API 9.2.15.v20160210.jar
WebSocket的客户端,9.2.15.v20160210.jar
WebSocket的-共9.2.15.v20160210.jar
xalan的-2.7.2.jar
xercesImpl-2.11.0.jar
XML的API-1.4.01.jar
ZT-拉链1.8.jar

0 个答案:

没有答案