標籤:origin 變數 搭建 build test har 劃線 字母 utf-8
轉自:http://www.jianshu.com/p/3c05e8c9ee81
我們使用Java+Selenium WebDriver 來進行環境的搭建,同樣分為兩個部分:
- 安裝Java 和 intellij IDEA
- 引入指定Selenium的 Maven使用的
pom.xml檔案
Maven 是一個用於項目構建的工具,通過它便捷的管理項目的生命週期。同時 Maven 不只是一個簡單的項目構建工具,還是一個依賴管理工具和項目資訊管理工具。它提供了中央倉庫,能幫我們自動下載構建。
標準的安裝步驟
-
選擇Java的版本並安裝 Java 1.8
-
使用IDEA建立Project
-
New Project | Maven Project
GroupId:org.seleniumhq.selenium
ArtifactId:selenium-parent
Version:2.53.1
-
複製 下列xml檔案selenium-pom.xml的內容到pom.xml中
<?xml version="1.0" encoding="UTF-8"?><project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-parent</artifactId> <version>2.53.1</version> </parent> <artifactId>selenium-server</artifactId> <name>selenium-server</name> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-remote-driver</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-exec</artifactId> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8</version> </dependency> </dependencies> <build> <resources> <resource> <directory>src/main/resources</directory> </resource> </resources> </build></project>
?
開始使用WebDriver
在使用WebDriver之前,我們需要先做一些語言的背景學習。主要包括物件導向的理念、Python的基本使用以及Java的基本使用幾個部分。
-
物件導向的理念
類,Class,指的是一個模板,一種設計範本。
-
Python的使用
PyCharm工具是Python的編程工具,.py檔案是Python的副檔名。
Python的檔案使用 xxx_xxx.py的方式命名,單詞全部小寫,中間用底線加入。
關於Python的學習,可以參考以下兩個課程:
- Python入門,http://www.imooc.com/learn/177
- Python進階,http://www.imooc.com/learn/317
-
Java的使用
intellij IDEA工具是Java的編程工具。
Java的檔案使用XxxYyy.java的大駱駝方式命名,單詞的第一個字母大寫。
關於Java的學習,可以參考以下兩個課程:
- Java入門第一季,http://www.imooc.com/learn/85
- Java入門第二季,http://www.imooc.com/learn/124
Self_Java + Selenium + Maven 環境搭建步驟