505152535455565758
// by xpath dr.findElement(By.xpath("/html/body/form/div[3]/div/label/input")).click(); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
293031323334353637
// SendKeys to A dr.findElement(By.id("A")).sendKeys(Keys.chord("watir webdriver is better than selenium webdriver")); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
454647484950515253
System.out.println("element does not exist"); } Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
4041424344454647
WebElement link = dr.findElement(By.id("myModal")).findElement(By.id("click")); ((JavascriptExecutor)dr).executeScript("$(arguments[0]).click()", link); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
6789101112131415
public static void main(String[] args) { WebDriver dr = new ChromeDriver(); System.out.println("browser will be closed"); dr.quit(); System.out.println("browser is closed"); } }
313233343536373839
((JavascriptExecutor)dr).executeScript("$(arguments[0]).fadeOut();", button); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }
373839404142434445
dr.switchTo().frame("f1"); dr.findElement(By.linkText("click")).click(); Thread.sleep(1000); System.out.println("browser will be close"); dr.quit(); } }