Appium TestNg Maven Android Eclipse java自动化环境搭建

时间:2021-08-18 10:01:24

1、环境准备 
1)Eclipse + maven + appium + TestNg 
确保已经在Eclipse 上面安装maven TestNg的插件

2)打开Eclipse,新建一个maven项目

2、配置依赖包,Appium需要三个包:appium client、selenium client、selenium server,如果我们不用maven构建工程,那么我们需要去下载这三个包,然后添加到我们的工程中,而maven不需要了,只需要配置依赖关系就可以了,我们可以在maven仓库中搜索我们需要的包,把他们的依赖关系写到pom.xml文件中:

maven仓库地址:http://mvnrepository.com/,例如搜索appium,就可以搜索到appium java client的包,选择最新的包,把依赖关系粘贴打pom.xml中,selenium client和selenium server只需要配置一个selenium依赖就行了,配置后的pom.xml文件如下:

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.13.0</version>
<scope>compile</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>

配置后保存,会自动更新依赖包,如果没有更新也可以在右键选中工程,选择Maven-Update Project,进行更新。更新完成后,你就发现你的Maven Dependencies多了很多jar包