当我从终端运行Selenium命令时,获取以下错误

时间:2014-04-21 15:44:00

标签: selenium

当我在终端上运行selenium命令,即ant test selenium-ui-functional时。 我得到以下错误

[javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:15: package org.openqa.selenium does not exist
    [javac] import org.openqa.selenium.*;
    [javac] ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:16: package org.openqa.selenium does not exist
    [javac] import org.openqa.selenium.By;
    [javac]                           ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:17: package org.openqa.selenium does not exist
    [javac] import org.openqa.selenium.Alert;
    [javac]                           ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:18: package org.openqa.selenium.firefox does not exist
    [javac] import org.openqa.selenium.firefox.FirefoxDriver;
    [javac]                                   ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:19: package org.openqa.selenium.support.ui does not exist
    [javac] import org.openqa.selenium.support.ui.Select;
    [javac]                                      ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:24: cannot find symbol
    [javac] symbol  : class WebDriver
    [javac] location: class com.sapienter.jbilling.selenium.sanity.JBillingSanityTest
    [javac]   private WebDriver driver;
    [javac]           ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/selenium/sanity/JBillingSanityTest.java:31: cannot find symbol
    [javac] symbol  : class FirefoxDriver
    [javac] location: class com.sapienter.jbilling.selenium.sanity.JBillingSanityTest
    [javac]     driver = new FirefoxDriver();
    [javac]                  ^
    [javac] /home/jbilling/jbilling-4/enterprise/test/functional/com/sapienter/jbilling/server/payment/WSTest.java:317: cannot find symbol
    [javac] symbol  : variable STATUS_SUSPENDED
    [javac] location: class com.sapienter.jbilling.server.user.UserDTOEx
    [javac]             user.setStatusId(UserDTOEx.STATUS_SUSPENDED);
    [javac]                                       ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 8 errors

BUILD FAILED
/home/jbilling/jbilling-4/enterprise/build.xml:122: The following error occurred while executing this line:
/home/jbilling/jbilling-4/enterprise/build.xml:185: Compile failed; see the compiler error output for details.

Total time: 12 seconds

我在testlib文件夹中插入了selenium-java-2.40.0.jar,selenium-server-standalone-2.40.0.jar。

拜托,有人可以告诉我这个问题的解决方案吗?

2 个答案:

答案 0 :(得分:0)

这个看起来像,但你还没有标记它。 (如果不是,我将删除/编辑此问题)

您需要确保selenium-java / selenium-api依赖关系具有正确的<scope>...</scope>

答案 1 :(得分:-1)

javac -cp "C:\selenium-2.42.2\selenium-java-2.42.2.jar;selenium-server-standalone-2.42.2.j‌​‌​ar" Test.java 

java -cp "C:\selenium-2.42.2\selenium-java-2.42.2.jar;.;selenium-server-standalone-2.42.2‌​‌​.jar" Test

测试是java文件名