Exemple #1
0
        private T To <T>(T pageObject, GoOptions options)
            where T : PageObject <T>
        {
            if (context.PageObject is null)
            {
                pageObject         = pageObject ?? ActivatorEx.CreateInstance <T>();
                context.PageObject = pageObject;

                if (!string.IsNullOrWhiteSpace(options.Url))
                {
                    ToUrl(options.Url);
                }

                pageObject.NavigateOnInit = options.Navigate;
                pageObject.Init();
                return(pageObject);
            }
            else
            {
                IPageObject currentPageObject = (IPageObject)context.PageObject;
                T           newPageObject     = currentPageObject.GoTo(pageObject, options);
                context.PageObject = newPageObject;
                return(newPageObject);
            }
        }
Exemple #2
0
        private static T To <T>(T pageObject, GoOptions options)
            where T : PageObject <T>
        {
            if (AtataContext.Current == null)
            {
                AtataContext.Build().SetUp();
            }

            if (AtataContext.Current.PageObject == null)
            {
                pageObject = pageObject ?? ActivatorEx.CreateInstance <T>();
                AtataContext.Current.PageObject = pageObject;

                if (!string.IsNullOrWhiteSpace(options.Url))
                {
                    ToUrl(options.Url);
                }

                pageObject.NavigateOnInit = options.Navigate;
                pageObject.Init();
                return(pageObject);
            }
            else
            {
                IPageObject currentPageObject = (IPageObject)AtataContext.Current.PageObject;
                T           newPageObject     = currentPageObject.GoTo(pageObject, options);
                AtataContext.Current.PageObject = newPageObject;
                return(newPageObject);
            }
        }