Find-Elements

Search for all elements whose xpath matches the given value.

Powershell

Search for all elements whose xpath attribute matches the given value. Returns: all elements whose xpath attribute matches the given value. Throws exception when there is a popup present.

Syntax

Find-Elements [-sessionId ] [-xpath] [-ignoreVisibility ] [-parentElement ] []

Find-Elements [-sessionId ] -using {ClassName | CssSelector | Id | Name | LinkText | PartialLinkText | TagName | XPath | PredicateString | ClassChain} -value [-ignoreVisibility ] [-parentElement ] []

Parameters

name description
sessionId (Optional) The identifier of the session to route the command to.
xpath The xpath used to locate elements.
using
value
ignoreVisibility (Optional) indicates whether non visible elements should be taken into account.
parentElement (Optional) limits the search to only descendants of this element.

Examples

Find-Elements -xpath "*[@marked='login']"

C#

Declaration

OpenQA.Selenium.Internal.IFindsByXPath::ReadOnlyCollection FindElementsByXPath(string xpath);

Arguments:

type name description
System.Collections.ObjectModel.ReadOnlyCollection xpath The XPath query to match.

Returns:

type description
OpenQA.Selenium.IWebElement A collection containing all IWebElements matching the criteria.

Examples

driver.findElementsByXPath(xPath);
driver.FindElementsById(id);
driver.FindElementsByClassName(className);
driver.FindElementsByPredicateString(className);
driver.FindElementsByClassChain(className);

Comments

FindElementsByClassChain and FindElementsByPredicateString are only supported on iOS

Last modified January 1, 0001