-
Notifications
You must be signed in to change notification settings - Fork 1
MarkerAttribute
Introduction to MarkerAttribute for PageObjects.
MarkerAttribute - is designed for decorating PageObjects.
[Marker(How = How.XPath, Pattern = "//*[text() = 'Some Text']")]
[Marker(How = How.CssSelector, Pattern = "#someUniqueId")]
public class YourPage: PageObject
{
// content
}
As you can see in example and you will see more in code MarkerAttribute awaits method (enumeration How
) and target (string Pattern
) in constructor. This functionality covers possibilities of By
class of Selenium WebDriver framework.
By specifying this attribute you are instructing the framework to check for presence of elements defined as Markers for particular page at the moment of it creation using IWebDriver.GetPage extension methods.
You can decorate your class with several MarkersAttributes as it is shown on example in order to specify set of Markers for a PageObject.
At the same time multiple reloads of framework IWebDriver.GetPage_ extension methods allow you replace defined markers in your PageObject class with other ones for a particular instance of your PageObject. Use
public static TPageObject GetPage<TPageObject>(params By[] markerSelectors);
public static TPageObject GetPage<TPageObject>(Boolean suppressLoading, params By[] markerSelectors);
public static TPageObject GetPage<TPageObject>(Action<TPageObject> pageTransformAction, params By[] markerSelectors);
methods with passing instances of By
class representing marker selectors to archive such behavior.
Index
- Overview
- Operation manual
- Advanced usage