Package org.openqa.selenium.chrome

Examples of org.openqa.selenium.chrome.ChromeDriver.findElement()


        DesiredCapabilities caps = DesiredCapabilities.chrome();
        caps.setCapability("chrome.prefs", preferences);
        caps.setCapability("chrome.switches", Arrays.asList("--user-data-dir=/Users/yihua/temp/chrome"));
        WebDriver webDriver = new ChromeDriver(caps);
        webDriver.get("http://huaban.com/");
        WebElement webElement = webDriver.findElement(By.xpath("/html"));
        System.out.println(webElement.getAttribute("outerHTML"));
        webDriver.close();
    }
}
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

//    ����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);
   
//    �����ť
    dr.findElement(By.id("btn")).click();
   
    (new WebDriverWait(dr, 10)).until(new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver d) {
                    return d.findElement(By.className("label")).isDisplayed();
                }
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

    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

    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);
   
//    clear
    element.clear();
View Full Code Here

    System.out.printf("now accesss %s \n", filePath);
   
    dr.get(filePath);
    Thread.sleep(1000);
   
    dr.findElement(By.cssSelector("input[type=file]")).sendKeys("src/navs.html");
   
    Thread.sleep(1000);
    System.out.println("browser will be close");
    dr.quit()
  }
View Full Code Here

    System.out.printf("now accesss %s \n", filePath);
   
    dr.get(filePath);
    Thread.sleep(1000);
   
    WebElement link = dr.findElement(By.id("tooltip"));
   
    System.out.println(link.getCssValue("color"));
   
    System.out.println(dr.findElement(By.tagName("h3")).getCssValue("font"));
   
View Full Code Here

   
    WebElement link = dr.findElement(By.id("tooltip"));
   
    System.out.println(link.getCssValue("color"));
   
    System.out.println(dr.findElement(By.tagName("h3")).getCssValue("font"));
   
    Thread.sleep(1000);
    System.out.println("browser will be close");
    dr.quit()
  }
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.