/// <summary> /// Initializes a new instance of the <see cref="CatalogTemplatePage"/> class. /// </summary> /// <param name="basePage">The base page.</param> /// <param name="driver">The driver.</param> /// <param name="pageObjectFactory">The page object factory.</param> /// <param name="pageSettings">The page settings.</param> /// <param name="template">The template.</param> public CatalogTemplatePage( IBasePage basePage, IPageObjectFactory pageObjectFactory, IWebDriver driver, PageSettings pageSettings, UriTemplate template) : base(driver, pageSettings.BaseUrl, template) { this.basePage = basePage; this.pageObjectFactory = pageObjectFactory; CategoriesComponent = new CatalogBlockComponent( categoryNavigationSelector, WrappedDriver); ManufacturersComponent = new CatalogBlockComponent( manufacturerSelector, WrappedDriver); PopularTagsComponent = new CatalogBlockComponent( popularTagsSelector, WrappedDriver); }
/// <summary> /// If overridding this don't forget to call base.Load(). /// NOTE: Will navigate to the pages url if the current drivers url /// is empty. /// </summary> /// <returns></returns> /// <remarks> /// If the driver is an EventFiringWebDriver an event listener will /// be added to the 'Navigated' event and uses the url to determine /// if the page is 'stale'. /// </remarks> public override ILoadableComponent Load() { base.Load(); basePage.Load(); pageObjectFactory.PrepareComponent(CategoriesComponent); pageObjectFactory.PrepareComponent(ManufacturersComponent); pageObjectFactory.PrepareComponent(PopularTagsComponent); // Verify this is displayed before loading it. if (WrappedDriver.FindElements(recentlyViewedProductsSelector).Any()) { RecentlyViewProductsComponent = new CatalogBlockComponent( recentlyViewedProductsSelector, WrappedDriver); pageObjectFactory.PrepareComponent(RecentlyViewProductsComponent); } else { // Assign to null if not loaded. RecentlyViewProductsComponent = null; } return(this); }