Example usage for org.openqa.selenium WebElement isEnabled

List of usage examples for org.openqa.selenium WebElement isEnabled

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement isEnabled.

Prototype

boolean isEnabled();

Source Link

Document

Is the element currently enabled or not?

Usage

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void verifyExpirationDateStatus(boolean status, int rowNumber) {
    rowNumber = rowNumber - 1;/*w  w w .  j av  a  2  s . c om*/
    WebElement expirationDateTxt = testWebDriver.getElementByName("expirationDate" + rowNumber);
    if (status)
        assertTrue("Expiration Date Disabled.", expirationDateTxt.isEnabled());
    else
        assertFalse("Expiration Date Enabled.", expirationDateTxt.isEnabled());
}

From source file:org.openlmis.pageobjects.FullCoveragePage.java

License:Open Source License

public boolean getStatusForField(String fieldName) {
    WebElement field = fullCoveragePageElements.get(fieldName);
    testWebDriver.waitForElementToAppear(field);
    return field.isEnabled();
}

From source file:org.openlmis.pageobjects.RequisitionGroupPage.java

License:Open Source License

public boolean isRemoveProgramScheduleEnabled(String programName) {
    WebElement programScheduleRemove = testWebDriver.getElementById("programScheduleRemove" + programName);
    testWebDriver.waitForElementToAppear(programScheduleRemove);
    return programScheduleRemove.isEnabled();
}

From source file:org.openlmis.pageobjects.RequisitionGroupPage.java

License:Open Source License

public boolean isEditProgramScheduleEnabled(String programName) {
    WebElement programScheduleEdit = testWebDriver.getElementById("programScheduleEdit" + programName);
    testWebDriver.waitForElementToAppear(programScheduleEdit);
    return programScheduleEdit.isEnabled();
}

From source file:org.openlmis.UiUtils.TestWebDriver.java

License:Open Source License

public void waitForElementToBeEnabled(final WebElement element) {
    (new WebDriverWait(driver, DEFAULT_WAIT_TIME)).until(new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver d) {
            return (element.isEnabled());
        }/*from   w w  w.  j  a  v a  2 s  . c  o  m*/
    });
}

From source file:org.paxml.selenium.webdriver.IsEnabledTag.java

License:Open Source License

/**
 * {@inheritDoc}//w w  w.  ja va2 s.  c  o m
 */
@Override
protected Object onCommand(Context context) {
    return handleElements(new IElementHandler() {

        public Object handle(WebElement ele) {
            return ele.isEnabled();
        }

    });
}

From source file:org.powertools.web.WebDriverBrowser.java

License:Open Source License

private boolean waitUntilItemIsEnabled(By locator, int timeout) {
    return executeCommandWhenElementAvailable(locator, timeout, new WebCommand() {

        @Override//from  ww w . j  a v  a  2  s  .co m
        public boolean execute(WebElement element) {
            return element.isEnabled();
        }
    });
}

From source file:org.powertools.web.WebDriverBrowser.java

License:Open Source License

private boolean waitUntilItemIsDisabled(By locator, int timeout) {
    return executeCommandWhenElementAvailable(locator, timeout, new WebCommand() {

        @Override//from  w ww. ja v  a2  s .  com
        public boolean execute(WebElement element) {
            return !element.isEnabled();
        }
    });
}

From source file:org.rivalry.example.dogbreed.DefaultDataCollectorTest.java

License:Open Source License

/**
 * Test the <code>fetchData()</code> method.
 *///from   w w w.  j ava2s. co  m
@Ignore
@Test
public void directTest() {
    System.out.println("start directTest()");

    final WebDriver webDriver = createWebDriver();
    webDriver.get("http://dogtime.com/dog-breeds/boston-terrier");

    final List<WebElement> groups = webDriver.findElements(By.className("breed-characteristic-group"));
    final WebElement seeAllCharacteristics = groups.get(groups.size() - 1);
    System.out.println("seeAllCharacteristics = " + seeAllCharacteristics);
    System.out.println("seeAllCharacteristics.getText() = [" + seeAllCharacteristics.getText() + "]");
    groups.get(groups.size() - 1).click();

    final WebElement parent = webDriver.findElement(By.className("characteristics"));
    assertNotNull(parent);
    assertTrue(parent.isDisplayed());
    assertTrue(parent.isEnabled());

    final List<WebElement> ratings = parent.findElements(By.className("five-star-ratings"));
    assertNotNull(ratings);
    assertThat(ratings.size(), is(25));

    {
        final WebElement element = ratings.get(0);
        System.out.println("element = " + element);
        assertNotNull(element);
        assertThat(element.getAttribute("class"), is("five-star-ratings five-star-ratings-5"));
    }

    {
        final WebElement element = ratings.get(1);
        assertNotNull(element);
        assertThat(element.getAttribute("class"), is("five-star-ratings five-star-ratings-4"));
    }

    final List<WebElement> h3s = parent.findElements(By.tagName("h3"));
    assertNotNull(h3s);
    assertThat(h3s.size(), is(25));

    {
        final WebElement element = h3s.get(0);
        System.out.println("element.getText() = [" + element.getText() + "]");
        assertNotNull(element);
        assertThat(element.getText(), is("Adapt well to apartment living"));
    }

    {
        final WebElement element = h3s.get(1);
        System.out.println("element.getText() = [" + element.getText() + "]");
        assertNotNull(element);
        assertThat(element.getText(), is("Affectionate with family"));
    }

    System.out.println("end directTest()");
}

From source file:org.specrunner.webdriver.actions.PluginClickNext.java

License:Open Source License

@Override
protected void process(IContext context, IResultSet result, WebDriver client, WebElement element)
        throws PluginException {
    List<WebElement> eles = element.findElements(By.xpath("following::*"));
    boolean found = false;
    for (WebElement we : eles) {
        if (prepare != null) {
            prepare.prepare(this, client, we);
        }//from   w w  w  . ja  va2 s .  c o  m
        if (we.isDisplayed() && we.isEnabled()) {
            if (prepare != null) {
                prepare.prepare(this, client, we);
            }
            found = true;
            break;
        }
    }
    if (!found) {
        throw new PluginException("Could not found a following visible element.");
    }
    result.addResult(Success.INSTANCE, context.peek());
}