congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
WebElement.findElements
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using org.openqa.selenium.WebElement.findElements (Showing top 20 results out of 900)

origin: spring-io/initializr

public WebElement dependency(String value) {
  for (WebElement element : this.form.findElements(By.name("style"))) {
    if (value.equals(element.getAttribute("value"))) {
      return element;
    }
  }
  throw new AssertionError("Dependency not found: " + value);
}
origin: selenide/selenide

@Override
public Void execute(SelenideElement proxy, WebElementSource selectField, Object[] args) {
 String text = (String) args[0];
 WebElement element = selectField.getWebElement();
 Select select = new Select(element);
 List<WebElement> options = element.findElements(By.xpath(
   ".//option[contains(normalize-space(.), " + Quotes.escape(text) + ")]"));
 if (options.isEmpty()) {
  throw new NoSuchElementException("Cannot locate option containing text: " + text);
 }
 for (WebElement option : options) {
  setSelected(option);
  if (!select.isMultiple()) {
   break;
  }
 }
 return null;
}
origin: cloudfoundry/uaa

@Test
public void testBannerFunctionalityInDiscoveryPage() {
  String zoneId = "testzone3";
  RestTemplate identityClient = IntegrationTestUtils.getClientCredentialsTemplate(
    IntegrationTestUtils.getClientCredentialsResource(baseUrl, new String[]{"zones.write", "zones.read", "scim.zones"}, "identity", "identitysecret")
  );
  IdentityZoneConfiguration config = new IdentityZoneConfiguration();
  config.setIdpDiscoveryEnabled(true);
  Banner banner = new Banner();
  banner.setText("test banner");
  banner.setBackgroundColor("#444");
  banner.setTextColor("#111");
  config.setBranding(new BrandingInformation());
  config.getBranding().setBanner(banner);
  IntegrationTestUtils.createZoneOrUpdateSubdomain(identityClient, baseUrl, zoneId, zoneId, config);
  String zoneUrl = baseUrl.replace("localhost",zoneId+".localhost");
  webDriver.get(zoneUrl);
  webDriver.manage().deleteAllCookies();
  webDriver.navigate().refresh();
  assertEquals("test banner", webDriver.findElement(By.cssSelector(".banner-header span")).getText());
  assertEquals("rgba(68, 68, 68, 1)", webDriver.findElement(By.cssSelector(".banner-header")).getCssValue("background-color"));
  assertEquals("rgba(17, 17, 17, 1)", webDriver.findElement(By.cssSelector(".banner-header span")).getCssValue("color"));
  String base64Val = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAATBJREFUeNqk008og3Ecx/HNnrJSu63kIC5qKRe7KeUiOSulTHJUTrsr0y5ycFaEgyQXElvt5KDYwU0uO2hSUy4KoR7v7/qsfmjPHvzq1e/XU8/39/3zPFHf9yP/WV7jED24nGRbxDFWUAsToM05zyKFLG60d/wmQBxWzwyOlMU1phELEyCmtPeRQRoVbKOM0VYB6q0QW+3IYQpJFFDEYFCAiMqwNY857Ko3SxjGBTbRXb+xMUamcMbWh148YwJvOHSCdyqTAdxZo72ADGwKT98C9CChcxUPQSVYLz50toae4Fy9WcAISl7AiN/RhS1N5RV5rOLxx5eom90pvGAI/VjHMm6bfspK18a1gXvsqM41XDVL052C1Tim56cYd/rR+mdSrXGluxfm5S8Z/HV9CjAAvQZLXoa5mpgAAAAASUVORK5CYII=";
  banner.setLogo(base64Val);
  IntegrationTestUtils.createZoneOrUpdateSubdomain(identityClient, baseUrl, zoneId, zoneId, config);
  webDriver.get(zoneUrl);
  assertEquals("data:image/png;base64," + base64Val, webDriver.findElement(By.cssSelector(".banner-header img")).getAttribute("src"));
  assertEquals(2, webDriver.findElement(By.cssSelector(".banner-header")).findElements(By.xpath(".//*")).size());
}
origin: la-team/light-admin

@Override
public void clear() {
  List<WebElement> closeButtons = theField.findElements( By.className( "search-choice-close" ) );
  for ( WebElement closeButton : closeButtons ) {
    closeButton.click();
  }
}
origin: la-team/light-admin

private Map<String, Column> setColumnHeaders() {
  List<WebElement> columnElements =
      dataTableElement.findElements(By.xpath(".//div[contains(@class, 'dataTables_scrollHeadInner')]//thead//th[contains(@class, 'header')]/div"));
  for ( WebElement columnElement : columnElements ) {
    Column column = new Column(columnElement);
    columns.put( column.getName(), column );
  }
  return columns;
}
origin: TEAMMATES/teammates

private String getSoftDeletedFeedbackSessionName(int rowId) {
  return browser.driver.findElement(By.id("tableSoftDeletedFeedbackSessions"))
      .findElements(By.xpath("tbody/tr")).get(rowId)
      .findElements(By.xpath("td")).get(1)
      .getText();
}
origin: la-team/light-admin

public String[] getFieldValuesExcludingId() {
  String[] allFieldValues = WebElementTransformer.transformToArray(
      dataContainer.findElements( By.xpath( "//td[contains(@name, 'field-')]" ) ) );
  return ArrayUtils.remove( allFieldValues, 0 );
}
origin: TEAMMATES/teammates

public boolean isAllVisibilityOptionsEnabledForNewQuestion() {
  List<WebElement> visibilityDropdownItems = browser.driver.findElement(By.id("questionTable-" + NEW_QUESTION_NUM))
      .findElements(By.cssSelector(".visibility-options-dropdown .dropdown-menu li"));
  for (WebElement item : visibilityDropdownItems) {
    if (item.getAttribute("class").contains("hidden")) {
      return false;
    }
  }
  return true;
}
origin: TEAMMATES/teammates

private String getFeedbackSessionCourseId(int rowId) {
  return browser.driver.findElement(By.id("table-sessions"))
             .findElements(By.xpath("tbody/tr")).get(rowId)
             .findElements(By.xpath("td")).get(0)
             .getText();
}
origin: TEAMMATES/teammates

private String getSoftDeletedFeedbackSessionCourseId(int rowId) {
  return browser.driver.findElement(By.id("tableSoftDeletedFeedbackSessions"))
      .findElements(By.xpath("tbody/tr")).get(rowId)
      .findElements(By.xpath("td")).get(0)
      .getText();
}
origin: TEAMMATES/teammates

public void clickCopyTableAtRow(int rowIndex) {
  WebElement row = browser.driver.findElement(By.id("copyTableModal"))
                  .findElements(By.tagName("tr"))
                  .get(rowIndex + 1);
  click(row);
}
origin: TEAMMATES/teammates

/**
 * Returns the value of the header located at {@code (row, column)}
 *         from the nth(0-index-based) table (which is of type {@code class=table}) in the page.
 */
public String getHeaderValueFromDataTable(int tableNum, int row, int column) {
  WebElement tableElement = browser.driver.findElements(By.className("table")).get(tableNum);
  WebElement trElement = tableElement.findElements(By.tagName("tr")).get(row);
  WebElement tdElement = trElement.findElements(By.tagName("th")).get(column);
  return tdElement.getText();
}
origin: TEAMMATES/teammates

/**
 * Unchecks every course in the course list.
 */
public void resetCoursesCheckboxes() {
  WebElement fsCopyModal = browser.driver.findElement(By.id("fsCopyModal"));
  List<WebElement> coursesCheckBoxes = fsCopyModal.findElements(By.name(Const.ParamsNames.COPIED_COURSES_ID));
  for (WebElement e : coursesCheckBoxes) {
    markCheckBoxAsUnchecked(e);
  }
}
origin: TEAMMATES/teammates

public void deselectUsersInRemindAllForm() {
  WebElement remindModal = browser.driver.findElement(By.id("remindModal"));
  List<WebElement> usersToRemind = remindModal.findElements(By.name("usersToRemind"));
  for (WebElement e : usersToRemind) {
    markCheckBoxAsUnchecked(e);
  }
}
origin: TEAMMATES/teammates

public void checkCheckboxesInForm(WebElement form, String elementsName) {
  List<WebElement> formElements = form.findElements(By.name(elementsName));
  for (WebElement e : formElements) {
    markCheckBoxAsChecked(e);
  }
}
origin: TEAMMATES/teammates

/**
 * Returns the number of rows from the nth(0-index-based) table
 *         (which is of type {@code class=table}) in the page.
 */
public int getNumberOfRowsFromDataTable(int tableNum) {
  WebElement tableElement = browser.driver.findElements(By.className("table")).get(tableNum);
  return tableElement.findElements(By.tagName("tr")).size();
}
origin: TEAMMATES/teammates

public void clickCopyTableRadioButtonAtRow(int rowIndex) {
  WebElement button = browser.driver.findElement(By.id("copyTableModal"))
                  .findElements(By.tagName("tr"))
                  .get(rowIndex + 1).findElement(By.tagName("input"));
  click(button);
}
origin: TEAMMATES/teammates

public boolean isRadioButtonChecked(int rowIndex) {
  WebElement button = browser.driver.findElement(By.id("copyTableModal"))
                  .findElements(By.tagName("tr"))
                  .get(rowIndex + 1).findElement(By.tagName("input"));
  return button.isSelected();
}
origin: TEAMMATES/teammates

public void clickVisibilityOptionForResponseCommentAndSave(String idString, int numOfTheCheckbox) {
  String idSuffix = idString.substring(18);
  WebElement commentRow = browser.driver.findElement(By.id(idString));
  click(commentRow.findElements(By.tagName("a")).get(1));
  WebElement commentEditForm = browser.driver.findElement(By.id("responseCommentEditForm" + idSuffix));
  click(commentRow.findElement(By.id("frComment-visibility-options-trigger" + idSuffix)));
  click(commentRow.findElements(By.cssSelector("input[type='checkbox']")).get(numOfTheCheckbox));
  click(commentEditForm.findElement(By.className("col-sm-offset-5")).findElement(By.tagName("a")));
  ThreadHelper.waitFor(1000);
}
origin: TEAMMATES/teammates

/**
 * Returns the number of columns from the header in the table
 *         (which is of type {@code class=table}) in the page.
 */
public int getNumberOfColumnsFromDataTable(int tableNum) {
  WebElement tableElement = browser.driver.findElements(By.className("table")).get(tableNum);
  WebElement trElement = tableElement.findElement(By.tagName("tr"));
  return trElement.findElements(By.tagName("th")).size();
}
org.openqa.seleniumWebElementfindElements

Javadoc

Find all elements within the current context using the given mechanism. When using xpath be aware that webdriver follows standard conventions: a search prefixed with "//" will search the entire document, not just the children of this current node. Use ".//" to limit your search to the children of this WebElement. This method is affected by the 'implicit wait' times in force at the time of execution. When implicitly waiting, this method will return as soon as there are more than 0 items in the found collection, or will return an empty list if the timeout is reached.

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.
  • isDisplayed
    Is this element displayed or not? This method avoids the problem of having to parse an element's "st
  • 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

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Top Sublime Text plugins
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