引入maven依赖
<!-- selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
selenium.properties 配置文件
prop.key=phantomjs.binary.path
prop.linux=/home/phantomjs-2.1.1/bin/phantomjs
prop.windows=F:/WebDriver/phantomjs.exe
prop.lucene=F:/lucene/index/
#prop.key=webdriver.chrome.driver
#prop.linux=/home/chromedriver
#prop.windows=F:/WebDriver/chromedriver.exe
SeleniumUtil 工具类
public class SeleniumUtil {
private Properties properties = getProperties();
private String osName = System.getProperties().getProperty("os.name");
/**
* 调用配置文件
*/
private Properties getProperties() {
Properties properties = new Properties();
try {