Class FindElements
- Namespace
- CSF.Screenplay.Selenium.Questions
- Assembly
- CSF.Screenplay.Selenium.dll
Represents a question that finds a collection of elements within a specified target.
public class FindElements : ISingleElementPerformableWithResult<SeleniumElementCollection>, ICanReportForElement
- Inheritance
-
FindElements
- Implements
- Inherited Members
Remarks
This question is used to find a collection of elements within a target. The matched/returned elements may be filtered by a Locator if one is specified, otherwise all descendent elements of the target will be returned.
Consumers are encouraged to specify a human-readable name for the collection of elements which are found, this will be kept with the returned collection of elements and will be visible in reports.
Constructors
FindElements(string, Locator)
Initializes a new instance of the FindElements class.
public FindElements(string elementsName = null, Locator locatorBasedMatcher = null)
Parameters
elementsNamestringAn optional short, descriptive, human-readable name to give to the collection of elements which are found.
locatorBasedMatcherLocatorAn optional Locator which should be used to filter the elements which are returned.
Methods
GetReportFragment(Actor, Lazy<SeleniumElement>, IFormatsReportFragment)
Counterpart to GetReportFragment(Actor, IFormatsReportFragment) except that this method also offers a Selenium element.
public ReportFragment GetReportFragment(Actor actor, Lazy<SeleniumElement> element, IFormatsReportFragment formatter)
Parameters
actorActorAn actor for whom to write the report fragment
elementLazy<SeleniumElement>The Selenium element for which the report is being written
formatterIFormatsReportFragmentA report-formatting service
Returns
- ReportFragment
A human-readable report fragment.
Remarks
Please see the documentation for GetReportFragment(Actor, IFormatsReportFragment) for more information.
PerformAsAsync(ICanPerform, IWebDriver, Lazy<SeleniumElement>, CancellationToken)
Counterpart to PerformAsAsync(ICanPerform, CancellationToken) except that this method also offers a Selenium WebDriver and element.
public ValueTask<SeleniumElementCollection> PerformAsAsync(ICanPerform actor, IWebDriver webDriver, Lazy<SeleniumElement> element, CancellationToken cancellationToken = default)
Parameters
actorICanPerformThe actor that is performing.
webDriverIWebDriverThe Selenium WebDriver provided from the actor's abilities.
elementLazy<SeleniumElement>The single Selenium Element upon which this method should operate.
cancellationTokenCancellationTokenAn optional cancellation token by which to abort the performable.
Returns
- ValueTask<SeleniumElementCollection>
A task which exposes a strongly-typed 'result' value when the performable represented by the current instance is complete.