Example usage for org.openqa.selenium WebDriver findElements

List of usage examples for org.openqa.selenium WebDriver findElements

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriver findElements.

Prototype

@Override
List<WebElement> findElements(By by);

Source Link

Document

Find all elements within the current page using the given mechanism.

Usage

From source file:org.jitsi.meet.test.pageobjects.web.DialInNumbersPage.java

License:Apache License

/**
 * Searches the displayed dial in numbers to verify if the passed in number
 * is displayed.//from w  w  w. j  a v a  2s  .  c o m
 *
 * @param number - The number to find in the page.
 * @return Whether or not the passed in number is displayed.
 */
public boolean includesNumber(String number) {
    WebDriver driver = participant.getDriver();

    List<WebElement> elements = driver.findElements(By.className(NUMBER));

    WebElement element = elements.stream().filter(e -> e.getText().equals(number)).findFirst().orElse(null);

    return element != null;
}

From source file:org.jitsi.meet.test.pageobjects.web.InfoDialog.java

License:Apache License

/**
 * Private helper to determine if the passed in className is displayed.
 * Used internally to determine if what kind of conference lock state the
 * info dialog is display.//from ww w  . j  a v a 2 s  .  co  m
 *
 * @param className - The class name to search for that signifies the
 *                  current lock state of the conference.
 * @return {@code true} if the info dialog has the passed in class,
 * {@code false} otherwise.
 */
private boolean getLockStateByClass(String className) {
    open();

    WebDriver driver = participant.getDriver();
    return driver.findElements(By.className(className)).size() != 0;
}

From source file:org.jitsi.meet.test.util.MeetUIUtils.java

License:Apache License

/**
 * Returns <video> element for the local video.
 * @param participant the <tt>WebDriver</tt> from which local video element
 * will be obtained./* w w w .  j  a  v a2  s . c om*/
 * @return <tt>WebElement</tt> of the local video.
 */
public static WebElement getLocalVideo(WebDriver participant) {
    List<WebElement> peerThumbs = participant
            .findElements(By.xpath("//video[starts-with(@id, 'localVideo_')]"));

    return peerThumbs.get(0);
}

From source file:org.jitsi.meet.test.util.MeetUIUtils.java

License:Apache License

/**
 * Returns all remote video elements for given <tt>WebDriver</tt> instance.
 * @param participant the <tt>WebDriver</tt> instance which will be used to
 * obtain remote video elements.// w  w  w.  j a va 2s  . co m
 * @return a list of <tt>WebElement</tt> with the remote videos.
 */
public static List<WebElement> getRemoteVideos(WebDriver participant) {
    return participant.findElements(By.xpath("//video[starts-with(@id, 'remoteVideo_')]"));
}

From source file:org.jitsi.meet.test.util.MeetUIUtils.java

License:Apache License

/**
 * Makes sure that a user's avatar is displayed, and that the user's video
 * is not displayed. Allows for the these conditions to not hold
 * immediately, but within a time interval of 5 seconds.
 * @param participant instance of <tt>WebDriver</tt> on which we'll perform
 * the verification.//from   w ww  . j  a va 2 s .  c om
 * @param resource the resource part of MUC JID which identifies user's
 * video thumbnail.
 */
public static void assertAvatarDisplayed(WebDriver participant, String resource) {
    // Avatar image
    TestUtils.waitForDisplayedElementByXPath(participant,
            "//span[@id='participant_" + resource + "']" + "/img[@class='userAvatar']", 5);

    // User's video if available should be hidden, the element is missing
    // if remote participant started muted when we joined
    String videoElementXPath = "//span[@id='participant_" + resource + "']/video";
    List<WebElement> videoElems = participant.findElements(By.xpath(videoElementXPath));
    if (videoElems.size() > 0) {
        TestUtils.waitForNotDisplayedElementByXPath(participant, videoElementXPath, 5);
    }
}

From source file:org.jitsi.meet.test.util.MeetUIUtils.java

License:Apache License

/**
 * Makes sure that a user's display name is displayed, and that
 * the user's thumbnail and avatar are not displayed. Allows for the these
 * conditions to not hold immediately, but within a time interval of 5
 * seconds./*from w  w  w. ja  v  a 2 s . c o m*/
 * @param participant instance of <tt>WebDriver</tt> on which we'll perform
 * the verification.
 * @param resource the resource part of MUC JID which identifies user's
 * video thumbnail.
 */
public static void assertDisplayNameVisible(WebDriver participant, String resource) {
    // Avatar image - hidden
    TestUtils.waitForNotDisplayedElementByXPath(participant,
            "//span[@id='participant_" + resource + "']" + "/img[contains(@class, 'userAvatar')]", 5);

    // User's video - hidden, if it is available
    String videoElementXPath = "//span[@id='participant_" + resource + "']/video";
    List<WebElement> videoElems = participant.findElements(By.xpath(videoElementXPath));
    if (videoElems.size() > 0) {
        TestUtils.waitForNotDisplayedElementByXPath(participant, videoElementXPath, 5);
    }

    // Display name - visible
    TestUtils.waitForDisplayedElementByXPath(participant,
            "//span[@id='participant_" + resource + "']" + "//span[@class='displayname']", 5);
}

From source file:org.jitsi.meet.test.util.MeetUIUtils.java

License:Apache License

/**
 * Returns list of participant's thumbnails.
 * @param participant the instance of <tt>WebDriver</tt>
 * @return list of thumbnails <tt>WebElement</tt> elements
 *//*from   www  .j a va2s  .  c  o m*/
public static List<WebElement> getThumbnails(WebDriver participant) {
    return participant
            .findElements(By.xpath("//div[@id='remoteVideos']/span[contains(@class,'videocontainer')]"));
}

From source file:org.jspringbot.keyword.selenium.ElementFinder.java

License:Open Source License

public static WebElement findById(WebDriver driver, String identifier, String tagName,
        Map<String, String> attributes) {
    return filterElements(driver.findElements(By.id(identifier)), tagName, attributes);
}

From source file:org.jspringbot.keyword.selenium.ElementFinder.java

License:Open Source License

public static WebElement findByName(WebDriver driver, String name, String tagName,
        Map<String, String> attributes) {
    return filterElements(driver.findElements(By.name(name)), tagName, attributes);
}

From source file:org.jspringbot.keyword.selenium.ElementFinder.java

License:Open Source License

public static WebElement findByXpath(WebDriver driver, String xpathExpression, String tagName,
        Map<String, String> attributes) {
    return filterElements(driver.findElements(By.xpath(xpathExpression)), tagName, attributes);
}