121314151617181920
System.out.printf("now accesss %s \n", url); dr.get(url); Thread.sleep(2000); System.out.println("browser will be close"); dr.quit(); } }
67891011121314
public static void main(String[] args) { WebDriver dr = new ChromeDriver(); dr.manage().window().setSize(new Dimension(240, 320)); dr.get("http://www.3g.qq.com/"); dr.quit(); } }
252627282930313233
System.out.println(dr.findElement(By.tagName("h3")).getCssValue("font")); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
232425262728293031
dr.findElement(By.cssSelector("input[type=file]")).sendKeys("src/navs.html"); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
313233343536373839
WebElement current = dr.findElement(By.className("breadcrumb")).findElement(By.className("active")); System.out.println(current.getText()); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
dr.manage().addCookie(c1); dr.manage().addCookie(c2); System.out.println("browser will be close"); dr.quit(); } }
System.out.printf("forward to %s \n", secondUrl); dr.navigate().forward(); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
323334353637383940
WebElement menu = dr.findElement(By.id("dropdown1")).findElement(By.linkText("Another action")); (new Actions(dr)).moveToElement(menu).perform(); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
// ͨ��ul�ٲ㼶��λ dr.findElement(By.className("dropdown-menu")).findElement(By.linkText("watir-webdriver")).click(); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
414243444546474849
System.out.println(alert.getText()); alert.accept(); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }