

OpenQA.Selenium.Support.PageObjects FindsByAttribute
Namespace: OpenQA.Selenium.Support.PageObjects
Assembly: WebDriver.Support (in WebDriver.Support.dll) Version: 2.35.0.0 (2.35.0.0)
public sealed class FindsByAttribute : Attribute, IComparable
You can use this attribute by specifying the How and Using properties
to indicate how to find the elements. This attribute can be used to decorate fields and properties
in your Page Object classes. The Type of the field or property must be either
IWebElement or IList{IWebElement}. Any other type will throw an
ArgumentException when InitElements(ISearchContext, Object) is called.
[FindsBy(How = How.Name, Using = "myElementName")] public IWebElement foundElement; [FindsBy(How = How.TagName, Using = "a")] public IList{IWebElement} allLinks;
You can also use multiple instances of this attribute to find an element that may meet one of multiple criteria. When using multiple instances, you can specify the order in which the criteria is matched by using the Priority property.
// Will find the element with the name attribute matching the first of "anElementName" // or "differentElementName". [FindsBy(How = How.Name, Using = "anElementName", Priority = 0)] [FindsBy(How = How.Name, Using = "differentElementName", Priority = 1)] public IWebElement thisElement;