天天看點

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檔案中:

繼續閱讀