예제 #1
0
 public void OpenPage(VIPage page)
 {
     VISite.Logger.Event("Open page: " + page.Url);
     WebDriver.Navigate().GoToUrl(page.Url);
     if (!new Timer(_site.WebDriverTimeouts.WaitPageToLoadInSec * 1000, _site.WebDriverTimeouts.RetryActionInMsec)
         .Wait(() => { WindowHandle = WebDriver.CurrentWindowHandle; return(true); }))
     {
         WindowHandle = WebDriver.CurrentWindowHandle;
     }
     _site.SiteSettings.CashDropTimes++;
     PagesHistory.Add(page);
     _currentPageNum++;
 }
예제 #2
0
        public VISite(Func <IWebDriver> webDriver, bool isMain = true)
        {
            Name          = NameAttribute.GetName(this);
            WebDriverFunc = webDriver;
            Logger        = new DefaultLogger();
            ((DefaultLogger)Logger).LogFileFormat = () => "{0}_" + RunId + ".log";
            Navigate = new Navigation(this);
            var site = SiteAttribute.Get(this);

            SiteSettings = new SiteSettings();
            if (site != null)
            {
                if (site.Domain != null)
                {
                    Domain = site.Domain;
                }
                if (isMain)
                {
                    isMain = site.IsMain;
                }
                if (site.UseCache)
                {
                    SiteSettings.UseCache = site.UseCache;
                }
                if (site.DemoMode)
                {
                    SiteSettings.DemoSettings = DemoSettingsAttribute.Get(this);
                }
                if (Alerting == null)
                {
                    Alerting = (site.ScreenshotAlert)
                        ? getScreenshotAlert()
                        : (IAlerting) new DefaultAllert();
                }
            }
            if (!isMain)
            {
                return;
            }
            VIElement.Init(this);
            VIPage.Init(this);
        }
예제 #3
0
        public void CheckPage(string name)
        {
            VIPage viPage = null;

            if (Pages.Any(page => String.Equals(page.Name, name, StringComparison.CurrentCultureIgnoreCase)))
            {
                viPage = Pages.First(page => String.Equals(page.Name, name, StringComparison.CurrentCultureIgnoreCase));
            }
            if (PagesFields.Any(field => String.Equals(field.Name, name, StringComparison.CurrentCultureIgnoreCase)))
            {
                viPage = ((VIPage)PagesFields.First(field => String.Equals(field.Name, name, StringComparison.CurrentCultureIgnoreCase)).GetValue(this));
            }
            if (viPage != null)
            {
                viPage.VerifyPage(true);
            }
            else
            {
                Alerting.ThrowError("Can't check page '" + name + "'. Site have no pages with this name.");
            }
        }
예제 #4
0
 public void OpenPage(string uri)
 {
     OpenPage(new VIPage("Page with url " + VIPage.GetUrlValue(uri, _site), uri, site: _site));
 }