我尝试运行Selenium测试的Maven项目(maven -install)
以下是pom文件
<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>deprecated</groupId>
<artifactId>deprecated</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.46.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.46.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<forkMode>never</forkMode>
<suiteXmlFiles>
<suiteXmlFile>testsuite/TestSuiteBukalapak.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
编译错误,提示找不到包org.openqa.selenium、org.testng和org.testng.annotations等,就好像缺少了某些maven构建内容。
[INFO] Compiling 43 source files to D:\deprecated\selenium_testng\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[3,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[4,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[5,35] package org.openqa.selenium.support does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[6,18] package org.testng does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/Tambah_Alamat.java:[7,30] package org.testng.annotations does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[5,27] package org.openqa.selenium does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[6,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[7,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[8,34] package org.openqa.selenium.chrome does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[9,35] package org.openqa.selenium.firefox does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[10,35] package org.openqa.selenium.firefox does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[11,42] package org.openqa.selenium.support.events does not exist
[ERROR] /D:/deprecated/selenium_testng/src/deprecated/core/Settings.java:[12,18] package org.testng does not exist
你能帮我一下吗?我需要在pom文件中添加哪些特定的依赖项呢?谢谢。
org.openqa.selenium
的依赖? - AKSmvn eclipse:clean
和mvn eclipse:eclipse
。这是我的项目https://github.com/nguoianphu/selenium-testng-maven - Tuan