Selenium+IDEA+Maven+TestNG环境搭建

1、安装jdk。html

jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.htmljava

 

具体环境配置见:Jmeter安装及环境配置chrome

2、Maven安装、环境配置apache

一、Maven下载:http://maven.apache.org/download.cgioracle

二、Maven环境配置maven

 1>在系统变量内添加环境变量 M2_HOME(或者MAVEN_HOME),值为解压后的目录,如C:\Program Files\Java\apache-maven-3.3.3.工具

 2>在系统变量内Path中添加%M2_HOME%\binpost

3>win+R,运行cmd命令行:mvn -v    检查是否安装成功,以下图即成功!开发工具

 

3、准备Intellij IDEA开发工具url

Intellij IDEA开发工具破解见:http://www.cnblogs.com/lxj-dream/p/8653473.html

4、在Maven项目中添加Selenium和TestNG相关jar包的依赖

1. 在IDEA中新建一个Maven项目。

2.搜索到如下相关jar包的group ID, artifact ID, version等相关信息,并将此添加到pom.xml文件的dependencies中(项目中使用到的其余jar包也可至该网址上搜索到并添加至pom.xml文件):

Selenium-firefox-driver, selenium-chrome-driver, selenium-ie-driver, selenium-support, testng

 <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>3.11.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-firefox-driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.11.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.2</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>3.11.0</version>
    </dependency>
相关文章
相关标签/搜索