Tabnine Logo
WebElement.isDisplayed
Code IndexAdd Tabnine to your IDE (free)

How to use
isDisplayed
method
in
org.openqa.selenium.WebElement

Best Java code snippets using org.openqa.selenium.WebElement.isDisplayed (Showing top 20 results out of 1,071)

origin: selenide/selenide

 @Override
 public boolean apply(Driver driver, WebElement element) {
  return element.isDisplayed();
 }
};
origin: selenide/selenide

 @Override
 public boolean apply(Driver driver, WebElement element) {
  try {
   element.isDisplayed();
   return true;
  }
  catch (StaleElementReferenceException e) {
   return false;
  }
 }
};
origin: selenide/selenide

 @Override
 public boolean apply(Driver driver, WebElement element) {
  try {
   return !element.isDisplayed();
  }
  catch (StaleElementReferenceException elementHasDisappeared) {
   return true;
  }
 }
};
origin: selenide/selenide

private Describe isDisplayed(WebElement element) {
 try {
  if (!element.isDisplayed()) {
   sb.append(' ').append("displayed:false");
  }
 } catch (UnsupportedOperationException e) {
  sb.append(' ').append("displayed:").append(e);
 } catch (InvalidElementStateException e) {
  sb.append(' ').append("displayed:").append(e);
 }
 return this;
}
origin: galenframework/galen

@Override
public boolean isVisible() {
  try {
    return getWebElement().isDisplayed();
  }
  catch (StaleElementReferenceException e) {
    return false;
  }
}
origin: selenide/selenide

 @Override
 public Boolean execute(SelenideElement proxy, WebElementSource locator, Object[] args) {
  try {
   WebElement element = locator.getWebElement();
   return element != null && element.isDisplayed();
  } catch (WebDriverException | ElementNotFound elementNotFound) {
   if (Cleanup.of.isInvalidSelectorError(elementNotFound)) {
    throw Cleanup.of.wrap(elementNotFound);
   }
   return false;
  } catch (IndexOutOfBoundsException invalidElementIndex) {
   return false;
  }
 }
}
origin: selenide/selenide

 @Override
 public WebElement execute(SelenideElement proxy, WebElementSource locator, Object[] args) {
  boolean selected = (Boolean) args[0];
  WebElement element = locator.getWebElement();
  if (!element.isDisplayed()) {
   throw new InvalidStateException(locator.driver(), "Cannot change invisible element");
  }
  String tag = element.getTagName();
  if (!tag.equals("option")) {
   if (tag.equals("input")) {
    String type = element.getAttribute("type");
    if (!type.equals("checkbox") && !type.equals("radio")) {
     throw new InvalidStateException(locator.driver(), "Only use setSelected on checkbox/option/radio");
    }
   }
   else {
    throw new InvalidStateException(locator.driver(), "Only use setSelected on checkbox/option/radio");
   }
  }
  if (element.getAttribute("readonly") != null || element.getAttribute("disabled") != null) {
   throw new InvalidStateException(locator.driver(), "Cannot change value of readonly/disabled element");
  }
  if (element.isSelected() != selected) {
   click.execute(proxy, locator, NO_ARGS);
  }
  return proxy;
 }
}
origin: cloudfoundry/uaa

@Test
public void theHeaderDropdown() throws Exception {
  Assert.assertNotNull(asOnHomePage.getUsernameElement());
  Assert.assertFalse(asOnHomePage.getAccountSettingsElement().isDisplayed());
  Assert.assertFalse(asOnHomePage.getSignOutElement().isDisplayed());
  asOnHomePage.getUsernameElement().click();
  Assert.assertTrue(asOnHomePage.getAccountSettingsElement().isDisplayed());
  Assert.assertTrue(asOnHomePage.getSignOutElement().isDisplayed());
  asOnHomePage.getAccountSettingsElement().click();
  Assert.assertThat(webDriver.findElement(By.cssSelector("h1")).getText(), Matchers.containsString("Account Settings"));
}
origin: testcontainers/testcontainers-java

protected static void doSimpleExplore(BrowserWebDriverContainer rule) {
  RemoteWebDriver driver = setupDriverFromRule(rule);
  driver.get("http://en.wikipedia.org/wiki/Randomness");
  // Oh! The irony!
  assertTrue("Randomness' description has the word 'pattern'", driver.findElementByPartialLinkText("pattern").isDisplayed());
}
origin: cloudfoundry/uaa

@Test
public void displaysErrorWhenPasswordContravenesPolicy() {
  //the only policy we can contravene by default is the length
  String newPassword = new RandomValueStringGenerator(260).generate();
  webDriver.get(baseUrl + "/change_password");
  signIn(userEmail, PASSWORD);
  changePassword(PASSWORD, newPassword, newPassword);
  WebElement errorMessage = webDriver.findElement(By.className("error-message"));
  assertTrue(errorMessage.isDisplayed());
  assertEquals("Password must be no more than 255 characters in length.", errorMessage.getText());
}
origin: cloudfoundry/uaa

@Test
public void testChangePassword() throws Exception {
  webDriver.get(baseUrl + "/change_password");
  signIn(userEmail, PASSWORD);
  changePassword(PASSWORD, NEW_PASSWORD, "new");
  WebElement errorMessage = webDriver.findElement(By.className("error-message"));
  assertTrue(errorMessage.isDisplayed());
  assertEquals("Passwords must match and not be empty.", errorMessage.getText());
  changePassword(PASSWORD, NEW_PASSWORD, NEW_PASSWORD);
  signOut();
  signIn(userEmail, NEW_PASSWORD);
}
origin: stackoverflow.com

public static final Condition hidden = new Condition("hidden", true) {
 @Override
 public boolean apply(WebElement element) {
  try {
   return !element.isDisplayed();
  } catch (StaleElementReferenceException elementHasDisappeared) {
   return true;
  }
 }
};
origin: TEAMMATES/teammates

/**
 * Returns true if the status message modal is visible.
 */
public boolean isFormSubmissionStatusMessageVisible() {
  return copyModalStatusMessage.isDisplayed();
}
origin: TEAMMATES/teammates

public boolean isElementVisible(String elementId) {
  try {
    return browser.driver.findElement(By.id(elementId)).isDisplayed();
  } catch (NoSuchElementException e) {
    return false;
  }
}
origin: TEAMMATES/teammates

public boolean verifyDuplicateButtonIsDisplayed(int qnIndex) {
  WebElement duplicateBn = browser.driver.findElement(
      By.xpath("//a[contains(@class, 'btn-duplicate-qn')][@data-qnnumber='" + qnIndex + "']"));
  return duplicateBn.isDisplayed();
}
origin: TEAMMATES/teammates

public boolean isNamedElementVisible(String elementName) {
  try {
    return browser.driver.findElement(By.name(elementName)).isDisplayed();
  } catch (NoSuchElementException e) {
    return false;
  }
}
origin: TEAMMATES/teammates

public boolean isDiscardChangesButtonVisible(int qnIndex) {
  WebElement discardChangesButton =
      browser.driver.findElement(
          By.xpath("//a[contains(@class, 'btn-discard-changes')][@data-qnnumber='" + qnIndex + "']"));
  return discardChangesButton.isDisplayed();
}
origin: TEAMMATES/teammates

public void verifyPanelForParticipantIsDisplayed(String participantIdentifier) {
  WebElement panel = browser.driver.findElement(
      By.xpath("//div[contains(@class, 'panel-primary') or contains(@class, 'panel-default')]"
            + "[contains(.,'[" + participantIdentifier + "]')]"));
  assertTrue(panel.isDisplayed());
}
origin: TEAMMATES/teammates

/**
 * Checks if the course edit form is enabled.
 * @return true if the course edit form is enabled
 */
public boolean isCourseEditFormEnabled() {
  return !courseIdTextBox.isEnabled() && courseNameTextBox.isEnabled() && saveCourseButton.isDisplayed();
}
origin: TEAMMATES/teammates

public boolean clickShowNewInstructorFormButton() {
  click(showNewInstructorFormButton);
  return newInstructorNameTextBox.isEnabled()
      && newInstructorEmailTextBox.isEnabled()
      && addInstructorButton.isDisplayed();
}
org.openqa.seleniumWebElementisDisplayed

Javadoc

Is this element displayed or not? This method avoids the problem of having to parse an element's "style" attribute.

Popular methods of WebElement

  • getText
    Get the visible (i.e. not hidden by CSS) text of this element, including sub-elements.
  • click
    Click this element. If this causes a new page to load, you should discard all references to this ele
  • sendKeys
    Use this method to simulate typing into an element, which may set its value.
  • getAttribute
    Get the value of the given attribute of the element. Will return the current value, even if this has
  • clear
    If this element is a text entry element, this will clear the value. Has no effect on other elements.
  • findElements
    Find all elements within the current context using the given mechanism. When using xpath be aware th
  • isSelected
    Determine whether or not this element is selected or not. This operation only applies to input eleme
  • findElement
    Find the first WebElement using the given method. See the note in #findElements(By) about finding vi
  • getTagName
    Get the tag name of this element. Not the value of the name attribute: will return"input" for the el
  • isEnabled
    Is the element currently enabled or not? This will generally return true for everything but disabled
  • getLocation
    Where on the page is the top left-hand corner of the rendered element?
  • submit
    If this current element is a form, or an element within a form, then this will be submitted to the r
  • getLocation,
  • submit,
  • getSize,
  • getCssValue,
  • getRect,
  • getScreenshotAs,
  • getValue,
  • setSelected,
  • toggle

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now