コード例 #1
0
        public PageInfo Analyze(Type pageType)
        {
            _page = _infoProvider.GetPageInfo(pageType);
            if (!_page.Analysis.IsDone)
            {
                var waitSelector = _page.Page?.Meta?.Wait;
                if (!string.IsNullOrWhiteSpace(waitSelector))
                {
                    _page.Analysis.WaitForElement(waitSelector);
                }

                TypeAnalyzer.Analyze(pageType, this);

                _page.Analysis.IsDone = true;
            }
            return(_page);
        }
コード例 #2
0
        public TPage GetPage <TApp, TPage>(IWebDriver driver)
        {
            if (driver == null)
            {
                throw new ArgumentNullException(nameof(driver));
            }

            var appInfo  = _infoProvider.GetAppInfo <TApp>();
            var pageInfo = _infoProvider.GetPageInfo <TPage>(appInfo);

            var pageUrl    = pageInfo.GetPageUrl();
            var browserUrl = driver.Url;

            var pageBuilder = _objectFactory.GetInstance <IPageFactory>();

            if (!pageUrl.Equals(browserUrl, StringComparison.OrdinalIgnoreCase))
            {
                pageBuilder.NavigateToPageFirst();
            }

            return(pageBuilder.BuildPage <TPage>(driver));
        }