Ejemplo n.º 1
0
        public T GetInstance <T>() where T : PageBase
        {
            IPageObjectFactory objectFactory = new PageObjectFactory();
            T page = objectFactory.Create <T>(_driver);

            return(page);
        }
        /// <summary>
        ///     Clicks on a wrapped WebElement and creates new page object instance of given type.
        /// </summary>
        /// <typeparam name="TPage">
        ///     The type of page object being created.
        /// </typeparam>
        /// <returns>
        ///     New page object instance.
        /// </returns>
        public TPage Open <TPage>()
        {
            IWebDriver wd = WrappedDriver;

            Click();

            return(PageObjectFactory.Create <TPage>(wd));
        }
        /// <summary>
        ///     Clicks on wrapped WebElement, waits until new window is opened and switches to it.
        /// </summary>
        /// <typeparam name="TPage">
        ///     Type of page object being created.
        /// </typeparam>
        /// <returns>
        ///     New page object instance.
        /// </returns>
        public TPage OpenInNewWindow <TPage>()
        {
            IWebDriver wd = WrappedDriver;

            wd.WaitUntilNewWindowOpened(Click);
            wd.SwitchToLastOpenedWindow();

            return(PageObjectFactory.Create <TPage>(wd));
        }
Ejemplo n.º 4
0
        public void Initialize <T>() where T : IPage
        {
            IPageObjectFactory pageObjectFactory = new PageObjectFactory();

            currentPage = pageObjectFactory.Create <T>(Driver);
        }