Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriver.findElement()


    WebElement radio = dr.findElement(By.name("radio"));
    radio.click();
    System.out.println(radio.isSelected());
   
    try{
      dr.findElement(By.id("none"));
    } catch(NoSuchElementException e){
      System.out.println("element does not exist");
    }
   
    Thread.sleep(1000);
View Full Code Here


   
    dr.get(filePath);
    Thread.sleep(1000);
   
//    �򿪶Ի���
    dr.findElement(By.id("show_modal")).click();
   
    (new WebDriverWait(dr, 10)).until(
        new ExpectedCondition<Boolean>() {
                    public Boolean apply(WebDriver d) {
                        return d.findElement(By.id("myModal")).isDisplayed();
View Full Code Here

   
//     ����Ի����е�����
//     ���ڶԻ����е�Ԫ�ر��ɰ����ڵ���ֱ�ӵ���ᱨ Element is not clickable�Ĵ���
//     ����ʹ��js��ģ��click
//     ��watir-webdriver��ֻ��Ҫfire_event(:click)�Ϳ�����
    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()
View Full Code Here

//    ��ҳ����ֱ��ִ��js
    ((JavascriptExecutor)dr).executeScript("$('#tooltip').fadeOut();");
    Thread.sleep(1000);
   
//    ���Ѿ���λ��Ԫ����ִ��js
    WebElement button = dr.findElement(By.className("btn"));
    ((JavascriptExecutor)dr).executeScript("$(arguments[0]).fadeOut();", button);
     
   
    Thread.sleep(1000);
    System.out.println("browser will be close");
View Full Code Here

    page.enterText(SOME_TEXT);
    page.next();

    // We should now be on the NextPage page
    assert driver.findElement(By.xpath("//div[@class='entry']"))
        .getText()
        .contains(SOME_TEXT)
        : "Value did not get passed via page chaining to next page";
  }
}
View Full Code Here

   
    dr.get(filePath);
    Thread.sleep(1000);
   
//    ����1���㼶��λ���ȶ�λul�ٶ�λli
    dr.findElement(By.className("nav")).findElement(By.linkText("About")).click();
    Thread.sleep(1000);
   
//    ����2: ֱ�Ӷ�λlink
    dr.findElement(By.linkText("Home")).click();
   
View Full Code Here

//    ����1���㼶��λ���ȶ�λul�ٶ�λli
    dr.findElement(By.className("nav")).findElement(By.linkText("About")).click();
    Thread.sleep(1000);
   
//    ����2: ֱ�Ӷ�λlink
    dr.findElement(By.linkText("Home")).click();
   
    Thread.sleep(1000);
    System.out.println("browser will be close");
    dr.quit()
  }
View Full Code Here

   
    dr.get(filePath);
    Thread.sleep(1000);
   
//    click
    dr.findElement(By.linkText("Link1")).click();
    Thread.sleep(1000);
    dr.findElement(By.linkText("Link1")).click();
   
//    send_keys
    WebElement element = dr.findElement(By.name("q"));
View Full Code Here

   
    dr.get(filePath);
    Thread.sleep(1000);
   
//    ��λtext��second�İ�ť
    List<WebElement> btns = dr.findElement(By.className("btn-group")).findElements(By.className("btn"));
   
    for(WebElement btn : btns){
      if(btn.getText().equals("second")){
        btn.click();
        break;
View Full Code Here

    Thread.sleep(1000);
   
//    click
    dr.findElement(By.linkText("Link1")).click();
    Thread.sleep(1000);
    dr.findElement(By.linkText("Link1")).click();
   
//    send_keys
    WebElement element = dr.findElement(By.name("q"));
    element.sendKeys("something");
    Thread.sleep(1000);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.