标签:mozilla org www 带来 junit4 exe down 单元测试 import
后续会带来testNG单元测试框架比junit框架更强大;
package cn.helloselenium; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.By; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; public class junitwebdriver { public WebDriver driver; String baseUrl="http://www.sogou.com/"; @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { System.setProperty("webdriver.gecko.driver", "C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe"); driver=new FirefoxDriver(); } @After public void tearDown() throws Exception { //driver.quit(); } @Test public void test() { //fail("Not yet implemented"); driver.get(baseUrl+"/"); driver.findElement(By.id("query")).sendKeys("junit4单元测试"); driver.findElement(By.id("stb")).click(); } }
标签:mozilla org www 带来 junit4 exe down 单元测试 import
原文地址:http://www.cnblogs.com/wangyinxu/p/6363090.html