Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium TestNG可以很好地运行原型测试,但在使用maven测试时不起作用_Maven_Selenium_Testng - Fatal编程技术网

Selenium TestNG可以很好地运行原型测试,但在使用maven测试时不起作用

Selenium TestNG可以很好地运行原型测试,但在使用maven测试时不起作用,maven,selenium,testng,Maven,Selenium,Testng,我正在学习Selenium/Maven/TestNG for CI教程(将添加jenkins)。当仅使用TestNG构建时,测试运行良好,但在使用“maven测试”时会出错 测试结果如下: import org.openqa.selenium.WebDriver; //import org.openqa.selenium.FirefoxDriver; import org.openqa.selenium.firefox.*; import org.testng.annotations.Test;

我正在学习Selenium/Maven/TestNG for CI教程(将添加jenkins)。当仅使用TestNG构建时,测试运行良好,但在使用“maven测试”时会出错

测试结果如下:

import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.FirefoxDriver;
import org.openqa.selenium.firefox.*;
import org.testng.annotations.Test;


public class GoogleTest {
private WebDriver driver;

@Test
public void verifySearch() {
    driver = new FirefoxDriver();
    driver.get("http://www.google.com/");
    driver.quit();
    }
}
下面是pom.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MavenWebDriverDemo</groupId>
<artifactId>MavenWebDriverDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.33.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.33.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.8</version>
        <scope>test</scope>
    </dependency>
</dependencies>

4.0.0
MavenWebDriverDemo


请帮助!谢谢!

ive已经在pom中添加了surefire插件…但是仍然存在类似的错误您有什么版本的FireFox?尝试将您的selenium依赖项更新为最新版本。另外,尝试运行
mvn clean测试
;在Eclipse中,这是作为>Maven clean运行的,然后是FF 27上的Maven test.im。ive更新为最新的dependencies…将尝试你提到的其他东西Maven中“最新版本”的语法是
[2.33.0,)
它变得更糟了…哈哈哈现在它说:无法执行目标org.apache.Maven.plugins:Maven编译器插件:2.5.1:testCompile(默认testCompile)在项目MavenWebDriverDemo上:编译时出现致命错误:找不到tools.jar:C:\Program Files\Java\jre8\..\lib\tools.jar