public object Decorate(MemberInfo member, IElementLocator locator) { var customizedResult = new DefaultPageObjectMemberDecorator().Decorate(member, locator); if (customizedResult != null) { return(customizedResult); } var property = member as PropertyInfo; if (property == null || !property.CanWrite || !property.GetMethod.IsPublic) { return(null); } var bys = new List <By> { By.Id(member.Name), new OrbitButtonLocator(member.Name), new OrbitTableFieldLocator(member.Name) }; bool cache = ShouldCacheLookup(member); return(CreateProxyObject(property.PropertyType, locator, bys, cache)); }
public HomePage(IWebDriver driver) { RetryingElementLocator retry = new RetryingElementLocator(driver, TimeSpan.FromSeconds(30)); IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator(); PageFactory.InitElements(retry.SearchContext, Driver, decor); }
/// <summary> /// <para> Implementation of Page Object Model </para> /// <para> PageFactory is a support class for the Selenium 2 Page Objects pattern </para> /// <para> RetryingElementLocator class used with the PageFactory which retries locating the element up to a timeout </para> /// Initializes all the page elements present in the DOM structure. /// /// </summary> protected PageBase() { var retry = new RetryingElementLocator(Driver, TimeSpan.FromSeconds(10)); IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator(); PageFactory.InitElements(retry.SearchContext, this, decor); //PageFactory.InitElements(Driver, this); }
public PageObject(IWebDriver driver) { this.driver = driver; driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); RetryingElementLocator retry = new RetryingElementLocator(driver, TimeSpan.FromSeconds(15)); IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator(); PageFactory.InitElements(retry.SearchContext, this, decor); }
/// <summary> /// Creates an instance of the Page Factory base class with re-trying locators. /// </summary> /// <param name="driver">The current WebDriver instance.</param> protected PageFactoryBase(IWebDriver driver) { Driver = driver; var timeout = TimeSpan.FromSeconds(DefaultWaitTimeout); Wait = new WebDriverWait(driver, timeout); var locator = new RetryingElementLocator(driver, timeout); var decorator = new DefaultPageObjectMemberDecorator(); PageFactory.InitElements(this, locator, decorator); }
public new static bool ShouldCacheLookup(MemberInfo member) => DefaultPageObjectMemberDecorator.ShouldCacheLookup(member);
public new static ReadOnlyCollection <By> CreateLocatorList(MemberInfo member) => DefaultPageObjectMemberDecorator.CreateLocatorList(member);