Selenium+IDEA+Maven+TestNG environment construction

First install the java environment.

1. Download and install Jdk1.7 or Jdk1.8

http://www.oracle.com/technetwork/java/javase/downloads/index.html

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2. Create a new environment variable JAVA_HOME, point to the jdk installation directory, such as C:\Program Files\Java\jdk1.7.0_75, add %JAVA_HOME%\bin and %JAVA_HOME\jre\bin to the Path variable, separated by semicolons open.

3. Open a cmd, execute java –version, and the java version number is displayed, indicating that the java installation is successful.

Second preparation Intellij IDEA development tools

1. Download and install IDEA

https://www.jetbrains.com/idea/download/

2. Search for a registration code online.

http://an0nymous.coding.io/getKeygen

The third configuration Maven environment.

1. Download Maven compatible with IDEA version (IDEA13 is not compatible with Maven3.3, but compatible with Maven3.1; IDEA14 is compatible with Maven3.3.)

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

2. Unzip Maven to a directory that is not easily passive, such as C:\Program Files\Java\apache-maven-3.3.3.

3. Create a new environment variable M2_HOME to point to the decompressed Maven directory, such as C:\Program Files\Java\apache-maven-3.3.3, and add %M2_HOME%\bin to the Path variable.

4. Copy the settings.xml file in the attachment to the following two paths:

a. C:\Users\User_Name\.m2

b. path\to\apache-maven-3.3.3\conf

5. Open a cmd, execute mvn –v, and the maven version number is displayed, indicating that the Maven installation is successful.

Fourth configuration Selenium2 Webdriver operating environment

1. Download the drivers used by IEDriverServer, chromedriver, etc. Firefox browser does not need to download the driver separately.

https://code.google.com/p/selenium/wiki/InternetExplorerDriver

https://code.google.com/p/selenium/wiki/SafariDriver

https://code.google.com/p/selenium/wiki/ChromeDriver

http://code.google.com/p/chromedriver/downloads/list

2. Create a new directory Selenium on the C drive, and put the downloaded driver file in C:\Selenium (you can put it in any location here, and you can specify the location in the code).

Fifth, add the dependencies of Selenium and TestNG related jar packages to the Maven project

1. Create a new Maven project in IDEA.

2. Go to http://mvnrepository.com/  to search for the group ID, artifact ID, version and other related information of the following related jar packages, and add this to the dependencies of the pom.xml file (other jars used in the project) Packages can also be searched at this URL and added to the pom.xml file):

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

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.8.8</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>2.46.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>2.46.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-safari-driver</artifactId>
    <version>2.46.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-ie-driver</artifactId>
    <version>2.47.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-htmlunit-driver</artifactId>
    <version>2.46.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-support</artifactId>
    <version>2.46.0</version>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>${log4j.version}</version>
</dependency>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325391996&siteId=291194637