天天看点

maven+selenium环境搭建

一、下载maven包

官网:

http://maven.apache.org/download.cgi

二、配置maven环境变量

maven+selenium环境搭建
maven+selenium环境搭建

 配置完之后验证一下:(若出现以下信息可看到maven的版本号就表示配置成功了)

maven+selenium环境搭建

修改settings.xml文件,指定本地仓库目录

maven+selenium环境搭建

配置镜像,指定下载jar包的地址:

maven+selenium环境搭建
<mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>      

三、Eclipse指定maven配置文件:

maven+selenium环境搭建
maven+selenium环境搭建

至此,eclipse就和maven关联好了,之后需要重启一下eclipse。

四、maven项目创建:

maven+selenium环境搭建

GroupId:分组,一般填写组织机构公司名字,如com.huawei

Artifact Id:项目包名(项目打包成jar包的ID,或者说jar包名字),如autotest

Version:版本(保持默认选项)

Packing:打包方式(保持默认选项)

maven+selenium环境搭建

至此,maven项目创建完毕。

五、接下来引入selenium依赖:

到maven中央仓库下载依赖坐标:

https://mvnrepository.com/

maven+selenium环境搭建
maven+selenium环境搭建
maven+selenium环境搭建

粘贴到项目的pom文件中:

继续阅读