文件名称:README.txt
文件大小:234B
文件格式:TXT
更新时间:2016-06-03 09:13:42
package selenium;
package selenium; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import static junit.framework.Assert.assertNotNull; public class WebDriverTest { private WebDriver page; @Before public void before() { page = new HtmlUnitDriver(); } @Test public void testHasAnImageSearchPage() throws Exception { page.get("http://www.google.cn"); WebElement searchBox = page.findElement(By.name("q")); searchBox.sendKeys("JavaEye"); WebElement subBtn = page.findElement(By.name("btnG")); subBtn.submit(); WebElement result = page.findElement(By.linkText("http://www.javaeye.com")); assertNotNull(result); } }