Transferred from: http://www.jianshu.com/p/3c05e8c9ee81
We use Java+selenium webdriver to build the environment, which is also divided into two parts:
- Installing Java and IntelliJ idea
- Files introduced by Maven using the specified selenium
pom.xml
Maven
is a tool for project building that conveniently manages the life cycle of a project. At the same time, Maven is not just a simple project building tool, but also a dependency management tool and project information management tool. It provides a central repository that can help us to download the build automatically.
Standard installation Steps
Select the Java version and install Java 1.8
Create a new project with idea
New Project | Maven Project
GroupId
:org.seleniumhq.selenium
ArtifactId
:selenium-parent
Version
:2.53.1
Copy the contents of the following XML file selenium-pom.xml
into the pom.xml
<?xml version="1.0" encoding="UTF-8"?><ProjectXmlns: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>
?
Getting Started with Webdriver
Before using Webdriver, we need to do some background learning of the language first. It mainly includes object-oriented concept, basic use of Python and several parts of basic Java usage.
Object-oriented philosophy
Classes, class, refers to a template, a design template.
Object : An object is an instance of a class, with 状态
and 行为
. For example, a panda is an object whose state is: name, age, gender, behavior: selling, eating bamboo, etc.
状态
: Member variables
行为
: Method
class : A class is a template, a drawing, which describes the behavior and state of a class of objects, the template or drawing is implemented, is an object.
Use of Python
The Pycharm tool is a Python programming tool, and the .py
file is a python extension.
Python files are xxx_xxx.py
named in the same way, the words are all lowercase, and the middle underline is added.
For Python learning, you can refer to the following two courses:
- Getting started with Python, http://www.imooc.com/learn/177
- Python Advanced, http://www.imooc.com/learn/317
Use of Java
The IntelliJ Idea tool is a programming tool for Java.
Java files are XxxYyy.java
named with the Big Camel, the first letter of the word capitalized.
For Java learning, you can refer to the following two courses:
- Introduction to Java first season, http://www.imooc.com/learn/85
- Introduction to Java second season, http://www.imooc.com/learn/124
Self_java + Selenium + Maven environment Setup steps