Package org.openqa.selenium

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


    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


   
    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

   
//     �ȵ�f1�ٵ�f2
    dr.switchTo().frame("f1");
    dr.switchTo().frame("f2");
//    ��f2�еİٶȹؼ����ı�������������
    dr.findElement(By.id("kw")).sendKeys("watir-webdriver");
    Thread.sleep(1000);
   
//    ֱ����������frame
    dr.switchTo().defaultContent();
View Full Code Here

//    ֱ����������frame
    dr.switchTo().defaultContent();

//    �ٵ�f1
    dr.switchTo().frame("f1");
    dr.findElement(By.linkText("click")).click();
   
    Thread.sleep(1000);
    System.out.println("browser will be close");
    dr.quit()
  }
View Full Code Here

    private void sendKeysToTinyMCE(CharSequence keysToSend)
    {
        WebDriver driver = getTest().getDriver();
        String windowHandle = driver.getWindowHandle();
        try {
            WebElement iframe = driver.findElement(By.className("mceEditorIframe"));
            driver.switchTo().frame(iframe).switchTo().activeElement().sendKeys(keysToSend);
        } finally {
            driver.switchTo().window(windowHandle);
        }
    }
View Full Code Here

     */
    public void dragAndDrop(By sourceLocator, By targetLocator)
    {
        // Selenium#dragAndDropToObject(source, target) is not implemented over WebDriver.
        WebDriver driver = getDriver();
        WebElement source = driver.findElement(sourceLocator);
        WebElement target = driver.findElement(targetLocator);
        // Don't click in the middle of the element because it can contain a link.
        new Actions(driver).moveToElement(source, 1, 1).clickAndHold().release(target).perform();
    }

View Full Code Here

    public void dragAndDrop(By sourceLocator, By targetLocator)
    {
        // Selenium#dragAndDropToObject(source, target) is not implemented over WebDriver.
        WebDriver driver = getDriver();
        WebElement source = driver.findElement(sourceLocator);
        WebElement target = driver.findElement(targetLocator);
        // Don't click in the middle of the element because it can contain a link.
        new Actions(driver).moveToElement(source, 1, 1).clickAndHold().release(target).perform();
    }

    /**
 
View Full Code Here

     */
    public void ensureElementIsNotCoveredByFloatingMenu(By locator)
    {
        WebDriver driver = getDriver();
        // First scroll the element into view, if needed, by moving the mouse to the top left corner of the element.
        new Actions(driver).moveToElement(driver.findElement(locator), 0, 0).perform();
        // Then scroll the page up a bit so that the element is not at the top of the window where the floating menu is.
        driver.findElement(By.xpath("//body")).sendKeys(Keys.ARROW_UP);
    }

    /**
 
View Full Code Here

    {
        WebDriver driver = getDriver();
        // First scroll the element into view, if needed, by moving the mouse to the top left corner of the element.
        new Actions(driver).moveToElement(driver.findElement(locator), 0, 0).perform();
        // Then scroll the page up a bit so that the element is not at the top of the window where the floating menu is.
        driver.findElement(By.xpath("//body")).sendKeys(Keys.ARROW_UP);
    }

    /**
     * Expands the object with the given number of the specified XClass. You need to call this method before editing any
     * of the properties of the specified object using the object editor because the form elements used to edit the
View Full Code Here

     * @return the rich text area element
     */
    protected RichTextAreaElement getRichTextArea()
    {
        WebDriver driver = getDriver();
        return new RichTextAreaElement(driver, driver.findElement(By.className("gwt-RichTextArea")));
    }

    /**
     * @return the source text area
     */
 
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.