标签:.exe repo assert www 参考 cli 百度 pre group
1. 用Eclipse创建maven工程,在pom.xml中添加依赖
1 <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> 2 <dependency> 3 <groupId>org.seleniumhq.selenium</groupId> 4 <artifactId>selenium-java</artifactId> 5 <version>3.0.1</version> 6 </dependency> 7 <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server --> 8 <dependency> 9 <groupId>org.seleniumhq.selenium</groupId> 10 <artifactId>selenium-server</artifactId> 11 <version>3.0.1</version> 12 </dependency>
*不同版本selenium依赖请参考 https://mvnrepository.com/artifact/org.seleniumhq.selenium
2.下载驱动
https://github.com/mozilla/geckodriver/releases
3.编写测试程序
1 @Test 2 public void test1() { 3 System.setProperty("webdriver.gecko.driver", "E:/selenium/geckodriver.exe"); 4 5 WebDriver driver = new FirefoxDriver(); 6 driver.get("http://www.baidu.com"); 7 8 Assert.assertEquals("百度一下,你就知道", driver.getTitle()); 9 driver.quit(); 10 }
标签:.exe repo assert www 参考 cli 百度 pre group
原文地址:http://www.cnblogs.com/snail53/p/6402017.html