Example usage for org.openqa.selenium WebElement isDisplayed

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

Introduction

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

Prototype

boolean isDisplayed();

Source Link

Document

Is this element displayed or not?

Usage

From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java

License:Apache License

/**
 * testAddWorkflow11().// ww  w .j  av a  2 s  . com
 * add Signature and then edit..
 *
 * @throws Exception Exception
 */
@Test
public void testAddWorkflow11() throws Exception {
    // given
    FormJSONFieldType typeSelect = FormJSONFieldType.SIGNATURE;
    ImmutableMap<String, String> values = ImmutableMap.of("20", "new field", "40", "Immediate[immediate]");

    // when - add step
    clickAddNewWorkflow();
    addBlankForm();

    menuDragAndDrop("menu-signature");

    // then
    WebElement element = findElementBy(By.className("signature-pad"));
    assertTrue(element.isDisplayed());
    assertEquals("", element.getText());

    checkEditField("1", typeSelect, values);
}

From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java

License:Apache License

/**
 * testAddWorkflow13().//  w ww .j a v a 2 s  . c o m
 * add textbox and then edit..
 *
 * @throws Exception Exception
 */
@Test
public void testAddWorkflow13() throws Exception {
    // given
    FormJSONFieldType typeSelect = FormJSONFieldType.TEXTBOX;
    ImmutableMap<String, String> values = ImmutableMap.of("20", "new label", "40", "Immediate[immediate]", "44",
            "Numbers[DecimalPad]", "61", "tvariable", "25", "Currency");

    // when - add step
    clickAddNewWorkflow();
    addBlankForm();

    menuDragAndDrop("menu-textbox");
    editField("1", values);

    // then
    WebElement element = findElementBy("input", "data-fieldid", "1");
    assertTrue(element.isDisplayed());
    assertEquals("", element.getText());

    checkEditField("1", typeSelect, values);
}

From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java

License:Apache License

/**
 * testAddWorkflow14().//from  ww w. ja  v a  2s  . c o  m
 * add textbox and then edit with custom formatter..
 *
 * @throws Exception Exception
 */
@Test
public void testAddWorkflow14() throws Exception {
    // given
    FormJSONFieldType typeSelect = FormJSONFieldType.TEXTBOX;
    Map<String, String> values = new LinkedHashMap<>();
    values.put("20", "Sample Label");
    values.put("40", "Immediate[immediate]");
    values.put("44", "Numbers[DecimalPad]");
    values.put("25", "Custom");
    values.put("61", "tvariable");
    values.put("24", "(ddd)");

    // when - add step
    clickAddNewWorkflow();
    addBlankForm();

    menuDragAndDrop("menu-textbox");
    editField("1", values);

    // then
    WebElement element = findElementBy("input", "data-fieldid", "1");
    assertTrue(element.isDisplayed());

    element.sendKeys("a456");
    assertEquals("(456)", element.getAttribute("value"));

    checkEditField("1", typeSelect, values);
}

From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java

License:Apache License

/**
 * testAddWorkflow15()./*from w w w.java2 s.  c o m*/
 * add formula and then edit.
 *
 * @throws Exception Exception
 */
@Test
public void testAddWorkflow15() throws Exception {
    // given
    FormJSONFieldType typeSelect = FormJSONFieldType.FORMULA;
    ImmutableMap<String, String> values = ImmutableMap.of("20", "Sample Label", "61", "tvariable", "78",
            "12*13");

    // when - add step
    clickAddNewWorkflow();
    addBlankForm();

    menuDragAndDrop("menu-formula");
    editField("1", values);

    // then
    WebElement element = findElementBy("input", "data-fieldid", "1");
    assertTrue(element.isDisplayed());
    assertEquals("", element.getText());

    checkEditField("1", typeSelect, values);
}

From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java

License:Apache License

/**
 * testAddWorkflow18()./*ww w .j a v  a  2s.  co  m*/
 * add 2 textbox and change order
 *
 * @throws Exception Exception
 */
@Test
public void testAddWorkflow18() throws Exception {
    // given
    ImmutableMap<String, String> values0 = ImmutableMap.of("20", "Sample Label", "40", "Immediate[immediate]",
            "44", "Numbers[DecimalPad]", "61", "tvariable", "25", "Currency");

    ImmutableMap<String, String> values1 = ImmutableMap.of("20", "Sample Label2", "40", "Immediate[immediate]",
            "44", "Numbers[DecimalPad]", "61", "tvariable", "25", "Currency");

    // when - add step
    clickAddNewWorkflow();
    addBlankForm();

    menuDragAndDrop("menu-textbox");
    editField("1", values0);

    addField(FormJSONFieldType.TEXTBOX);
    editField("2", values1);

    // then
    WebElement element = findElementBy("label", "data-fieldid", "1");
    assertTrue(element.isDisplayed());
    assertEquals("Sample Label", element.getText());

    element = findElementBy("label", "data-fieldid", "2");
    assertTrue(element.isDisplayed());
    assertEquals("Sample Label2", element.getText());

    // when - swap field positions
    moveField("1", "2");

    // then
    assertRowEquals(findElementsWithText(By.xpath("//label[@data-fieldid]")),
            Arrays.asList("Sample Label", "Sample Label2"));
}

From source file:com.gargoylesoftware.htmlunit.javascript.host.WebSocketTest.java

License:Apache License

private static void assertVisible(final String domId, final WebDriver driver) throws Exception {
    final WebElement domE = driver.findElement(By.id(domId));
    int counter = 0;
    do {/*from   w  w  w  . ja  va2 s  .c o m*/
        Thread.sleep(100);
    } while (!domE.isDisplayed() && counter++ < 10);

    assertEquals("Node should be visible, domId: " + domId, true, domE.isDisplayed());
}

From source file:com.ggasoftware.jdiuitest.web.selenium.elements.complex.BaseSelector.java

License:Open Source License

private boolean isDisplayedInList(List<WebElement> els, String name) {
    WebElement element = LinqUtils.first(els, el -> el.getText().equals(name));
    return element != null && element.isDisplayed();
}

From source file:com.ggasoftware.jdiuitest.web.selenium.elements.complex.TextList.java

License:Open Source License

public boolean waitVanishedAction() {
    return actions.findImmediately(() -> timer().wait(() -> {
        List<WebElement> elements = getWebElements();
        if (elements == null || elements.size() == 0)
            return true;
        for (WebElement el : getWebElements())
            if (el.isDisplayed())
                return false;
        return true;
    }), false);// w  w w  .  ja  va 2  s.  c o  m
}

From source file:com.github.jjYBdx4IL.test.selenium.SeleniumTestBaseTest.java

License:Apache License

/**
 * Wait until there is some element returned by {@link #findElement} which is displayed and enabled. The
 * timeout is given by {@link #CLICK_WAIT4ELEMENT_MILLIS}.
 *
 * @param text the text value of the element to select
 * @return/*from w w  w .  ja  va  2 s .c  o m*/
 * @throws WebElementNotFoundException
 */
public WebElement waitForElement(String text, Boolean displayed, Boolean enabled)
        throws WebElementNotFoundException {
    log.info("waitForElement(" + text + ")");

    WebElement e = null;
    long timeout = System.currentTimeMillis() + CLICK_WAIT4ELEMENT_MILLIS;
    do {
        try {
            e = findElement(text);
            if (e != null && enabled != null && enabled.booleanValue() != e.isEnabled()) {
                e = null;
            }
            if (e != null && displayed != null && displayed.booleanValue() != e.isDisplayed()) {
                e = null;
            }
        } catch (StaleElementReferenceException ex) {
            e = null;
        }
        if (e == null) {
            try {
                Thread.sleep(CLICK_WAIT4ELEMENT_POLL_MILLIS);
            } catch (InterruptedException ex) {
            }
        }
    } while ((e == null) && System.currentTimeMillis() < timeout);
    if (e == null) {
        throw new WebElementNotFoundException(text);
    }
    return e;
}

From source file:com.gmatuella.clinic.pageobjects.DashboardPage.java

public boolean getLoggedAdmin() {
    WebElement analyticsTab = loginPage.getLocalDriver()
            .findElement(By.xpath("//*[contains(@id,'analytics')]"));
    System.out.println(analyticsTab.isDisplayed());
    return true;/*from w w w  .ja v a 2 s. co m*/
}