Examples of WebElement


Examples of org.openqa.selenium.WebElement

    {
        getUtil().waitUntilCondition(new ExpectedCondition<WebElement>()
            {
                public WebElement apply(WebDriver driver)
                {
                    WebElement element = null;
                    for (int i = 0; i < locators.length; i++) {
                        try {
                            element = driver.findElement(locators[i]);
                        } catch (NotFoundException e) {
                            // This exception is caught by WebDriverWait
                            // but it returns null which is not necessarily what we want.
                            if (all) {
                                return null;
                            }
                            continue;
                        }
                        // At this stage it's possible the element is no longer valid (for example if the DOM has
                        // changed). If it's no longer attached to the DOM then consider we haven't found the element
                        // yet.
                        try {
                            if (element.isDisplayed()) {
                                if (!all) {
                                    return element;
                                }
                            } else if (all) {
                                return null;
View Full Code Here

Examples of org.openqa.selenium.WebElement

        getUtil().waitUntilCondition(new ExpectedCondition<Boolean>()
            {
                public Boolean apply(WebDriver driver)
                {
                    try {
                        WebElement element = driver.findElement(locator);
                        return !element.isDisplayed();
                    } catch (NotFoundException e) {
                        return Boolean.TRUE;
                    } catch (StaleElementReferenceException e) {
                        // The element was removed from DOM in the meantime
                        return Boolean.TRUE;
View Full Code Here

Examples of org.openqa.selenium.WebElement

        getUtil().waitUntilCondition(new ExpectedCondition<Boolean>()
            {
                public Boolean apply(WebDriver driver)
                {
                    try {
                        WebElement element = driver.findElement(locator);
                        return expectedValue.equals(element.getAttribute(attributeName));
                    } catch (NotFoundException e) {
                        return false;
                    } catch (StaleElementReferenceException e) {
                        // The element was removed from DOM in the meantime
                        return false;
View Full Code Here

Examples of org.openqa.selenium.WebElement

        getUtil().waitUntilCondition(new ExpectedCondition<Boolean>()
            {
                public Boolean apply(WebDriver driver)
                {
                    try {
                        WebElement element = driver.findElement(locator);
                        return element.getAttribute(attributeName).endsWith(expectedValue);
                    } catch (NotFoundException e) {
                        return false;
                    } catch (StaleElementReferenceException e) {
                        // The element was removed from DOM in the meantime
                        return false;
View Full Code Here

Examples of org.openqa.selenium.WebElement

    {
        getUtil().waitUntilCondition(new ExpectedCondition<Boolean>()
            {
                public Boolean apply(WebDriver driver)
                {
                    WebElement element = driver.findElement(locator);
                    return Boolean.valueOf(expectedValue.equals(element.getText()));
                }
            }
        );
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

    Portal portal;


    @When("I click the add page button")
    public void clickAddPage() {
        final WebElement addPageLink = portal.findElement(By.xpath("//li[@id='addPageButton']/a"));
        addPageLink.click();
        final WebElement pageForm = portal.findElement(By.id("pageForm"));
        assertThat(pageForm.isDisplayed(), equalTo(Boolean.TRUE));
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        layouts.selectByValue("columns_2");
    }

    @When("I add the page")
    public void submitAddPage() {
        final WebElement updateButton = portal.findElement(By.id("pageMenuUpdateButton"));
        updateButton.click();
        sleep(2000L);
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        sleep(2000L);
    }

    @Then("the new page with title \"$pageTitle\" is selected")
    public void checkNewPage(String pageTitle) {
        final WebElement activePage =
                portal.findElement(By.xpath("//div[@id='pageContent']/nav//li[contains(@class, 'active')]/a"));
        assertThat(activePage, notNullValue());
        assertThat(activePage.getText().trim(), equalTo(pageTitle));
        final WebElement emptyPageBox = portal.getEmptyPageBox();
        assertThat(emptyPageBox.isDisplayed(), equalTo(Boolean.TRUE));
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        assertThat(emptyPageBox.isDisplayed(), equalTo(Boolean.TRUE));
    }

    @When("I delete the current page")
    public void deleteCurrentPage() {
        final WebElement activePage =
                portal.findElement(By.xpath("//div[@id='pageContent']/nav//li[contains(@class, 'active')]/a"));
        activePage.click();
        sleep(2000L);
        final WebElement deletePageLink = portal.findElement(By.xpath("//li[@id='pageMenuDelete']/a"));
        deletePageLink.click();
        sleep(2000L);
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        sleep(2000L);
    }


    private void changeFieldValue(String fieldId, String value) {
        final WebElement field = portal.findElement(By.id(fieldId));
        field.clear();
        field.sendKeys(value);
    }
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.