コード例 #1
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to espn
            driver.NavigateToUrl("http://www.espn.com");
            driver.Wait(10);

            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Scroll down page");
            // Scroll through the infinite list
            driver.ScrollPage(20);
            ScenarioEventSourceProvider.EventLog.ScenarioActionStop("Scroll down page");

            timer.ExtractPageLoadTime("ESPN homepage");
        }
コード例 #2
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to Wikipedia/United_States
            driver.NavigateToUrl("https://en.wikipedia.org/wiki/United_States");
            driver.Wait(5);

            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Scroll down page");
            // Scroll a bit
            driver.ScrollPage(12);
            ScenarioEventSourceProvider.EventLog.ScenarioActionStop("Scroll down page");

            timer.ExtractPageLoadTime("Wikipedia article");
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Navigate
            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.CreateNewTab();
                driver.Wait(1);

                driver.NavigateToUrl("https://www.amazon.com/s/ref=nb_sb_ss_c_1_8/144-3151688-3660025?url=search-alias%3Daps&field-keywords=game+of+thrones&sprefix=Game+of+%2Caps%2C308&crid=JOGH2YETEMSW");
                driver.Wait(5);
            }
        }
コード例 #4
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to zillow, direct to a results page
            driver.NavigateToUrl("http://www.zillow.com/homes/98052_rb/?fromHomePage=true&shouldFireSellPageImplicitClaimGA=false");
            driver.Wait(10);

            // Expand map
            driver.ClickElement(driver.FindElementById("map-list-ratio-toggle"));
            driver.Wait(5);

            // Click on the first home
            driver.ClickElement(driver.FindElementByClassName("zsg-photo-card-overlay-link"));
            driver.Wait(5);
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to local static resource
            driver.NavigateToUrl(GetStaticResourceUrl());

            driver.Wait(1);

            // Toggle video to fullscreen
            var     fullscreenButton  = driver.FindElementById("fullscreen");
            Actions fullscreenActions = new Actions(driver);

            fullscreenActions.MoveToElement(fullscreenButton);
            fullscreenActions.Click().Perform();
        }
コード例 #6
0
        /// <summary>
        /// Instantiates a ScenarioRunner with the passed in arguments
        /// </summary>
        /// <param name="args"></param>
        public ScenarioRunner(Arguments args)
        {
            _e3RefreshDelaySeconds = 12;
            _iterations            = args.Iterations;
            _browserProfilePath    = args.BrowserProfilePath;
            _usingTraceController  = args.UsingTraceController;
            _etlPath = args.EtlPath;
            _extensionsStagingPath = "";
            _maxAttempts           = args.MaxAttempts;
            _overrideTimeout       = args.OverrideTimeout;
            _scenarios             = args.Scenarios.ToList();
            _browsers               = args.Browsers.ToList();
            _workloadName           = args.ScenarioName;
            _measureSets            = GetMeasureSetInfo(args.SelectedMeasureSets.ToList());
            _logins                 = new CredentialManager(args.CredentialPath);
            _timer                  = new ResponsivenessTimer();
            _captureBaseline        = args.CaptureBaseline;
            _baselineCaptureSeconds = args.BaselineCaptureSeconds;
            _clearBrowserCache      = args.ClearBrowserCache;
            _executeWarmupRun       = args.DoWarmupRun;
            _hostName               = args.Host;
            _port = args.Port;
            _enableVerboseLogging  = args.EnableVerboseWebDriverLogging;
            _disableWpr            = args.DisableWpr;
            _enableScenarioTracing = args.EnableScenarioTracing;
            _enableBrowserTracing  = args.EnableBrowserTracing;
            _windowMode            = args.WindowMode;
            _broArgs                  = args.BroArgs;
            _infiniteLoop             = args.InfiniteLoop;
            _pauseAfterBrowserStart   = args.PauseAfterBrowserStart;
            _pauseBetweenScenariosRun = 3;

            if (!string.IsNullOrEmpty(args.ExtensionsPath))
            {
                _extensionsPaths = GetExtensionPaths(args.ExtensionsPath);
            }
            else
            {
                _extensionsPaths = null;
            }

            if (args.MeasureResponsiveness)
            {
                _useTimer = true;
            }
            else
            {
                _useTimer = false;
            }
        }
コード例 #7
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            var blank = "about:blank";
            var sber  = "https://online.sberbank.ru";

            for (var i = 0; i < 5; i++)
            {
                driver.NavigateToUrl(blank);
                driver.Wait(1);

                driver.NavigateToUrl(sber);
                driver.Wait(1);
            }
        }
コード例 #8
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to static resource
            var staticUrl = GetStaticResourceUrl();

            driver.NavigateToUrl(staticUrl);

            for (var i = 0; i < 5; i++)
            {
                driver.Wait(1);

                driver.NavigateToUrl(GetStaticResourceUrl());
            }
        }
コード例 #9
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            driver.NavigateToUrl("http://www.facebook.com");
            driver.Wait(5);

            UserInfo credentials = credentialManager.GetCredentials("facebook.com");

            if (driver.Title == "Log into Facebook | Facebook" || driver.Title == "Facebook - Log In or Sign Up")
            {
                Logger.LogWriteLine("    Starting logging into Facebook...");
                ScenarioEventSourceProvider.EventLog.AccountLogInStart("Facebook");

                // if not logged on, log on
                var elems = driver.FindElements(By.CssSelector("H2"));
                driver.Wait(2);

                var username = driver.FindElement(By.Id("email"));
                var password = driver.FindElement(By.Id("pass"));

                username.Clear();
                username.Clear();

                driver.TypeIntoField(username, credentials.Username);
                driver.Wait(1);

                driver.TypeIntoField(password, credentials.Password + Keys.Enter);
                driver.Wait(1);

                ScenarioEventSourceProvider.EventLog.AccountLogInStop("Facebook");
                Logger.LogWriteLine("    Completed logging into Facebook...");
            }
            else
            {
                Logger.LogWriteLine("    Already logged into Facebook...");
            }

            // Check to makes sure the login was successful
            if (driver.Title == "Log into Facebook | Facebook" || driver.Title == "Facebook - Log In or Sign Up")
            {
                throw new Exception("Login to Facebook failed!");
            }

            // Once we're logged in, all we're going to do is scroll through the page
            // We're simply measuring a user looking through their news feed for a minute
            driver.Wait(5);
            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Scroll through timeline");
            driver.ScrollPage(20);
            ScenarioEventSourceProvider.EventLog.ScenarioActionStop("Scroll through timeline");
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Start local web server
            Task <string> webSrvTask = WebSrv.StartWebSrv(DefaultDuration, GetWebRootPath());

            // Nagivate to local static resource
            driver.NavigateToUrl(GetStaticResourceUrl());
            driver.Wait(5);

            // Launch live modal
            var liveModalLaunchButton = driver.FindElementById("live-example-modal-launch");

            //liveModalActions.MoveToElement(liveModalLaunchButton);
            driver.ExecuteScript("arguments[0].scrollIntoView(true);", liveModalLaunchButton);
            driver.Wait(5);
            driver.ClickElement(liveModalLaunchButton);
            driver.Wait(5);

            // Close live modal
            var liveModalCloseButton = driver.FindElementById("live-example-modal-close");

            driver.ExecuteScript("arguments[0].scrollIntoView(true);", liveModalCloseButton);
            driver.Wait(5);
            driver.ClickElement(liveModalCloseButton);
            driver.Wait(5);

            // Move to dropdowns
            var examplesDropdown = driver.FindElementById("dropdowns-examples");

            //dropdownsExamplesActions.MoveToElement(examplesDropdown);
            driver.ExecuteScript("arguments[0].scrollIntoView(true);", examplesDropdown);
            driver.Wait(5);

            // Click on dropdowns
            var dropdownButton = driver.FindElementById("dropdown-example-open");

            driver.ExecuteScript("arguments[0].scrollIntoView(true);", dropdownButton);
            driver.Wait(10);
            driver.ClickElement(dropdownButton);
            driver.Wait(5);

            // Move to carousel
            var examplesCarousel = driver.FindElementById("carousel-focus-here");

            driver.ExecuteScript("arguments[0].scrollIntoView(true);", dropdownButton);

            driver.Wait(5);
            WebSrv.StopWebSrv(Name);
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to URL to have same start conditions
            var url = "about:blank";

            driver.NavigateToUrl(url);

            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.CreateNewTab();
                driver.Wait(1);
            }
        }
コード例 #12
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager)
        {
            // Nagivate to wikipedia
            driver.Navigate().GoToUrl("https://en.wikipedia.org/wiki/United_States");

            Thread.Sleep(2 * 1000);
            if (browser == "firefox")
            {
                // With Firefox, we had to get focus onto the page, or else PgDn scrolled through the address bar
                driver.FindElementById("firstHeading").SendKeys(string.Empty);
            }

            // Scroll a bit
            driver.ScrollPage(12);
        }
コード例 #13
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Start local web server
            Task <string> webSrvTask = WebSrv.StartWebSrv(DefaultDuration, GetWebRootPath());

            // Nagivate to static resource
            var staticUrl = GetStaticResourceUrl();

            driver.NavigateToUrl(staticUrl);

            driver.Wait(5);
            driver.ExecuteScript("setInterval(function() { window.scrollBy({ top: 6, left: 0, behavior: \"smooth\" });}, 10);");

            WebSrv.StopWebSrv(Name);
        }
コード例 #14
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            var blank  = "about:blank";
            var html3d = "https://playcanvas.com/";

            driver.CreateNewTab();
            for (var i = 0; i < 20; i++)
            {
                driver.Wait(1);
                driver.NavigateToUrl(html3d);
                driver.Wait(2);
            }

            driver.NavigateToUrl(blank);
        }
コード例 #15
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager)
        {
            // Navigate
            driver.Navigate().GoToUrl("http://www.bbc.co.uk");
            driver.Wait(10);

            // Navigate to the hero headline
            driver.ClickElement(driver.FindElement(By.XPath("//*[@rev='hero1|headline']")));

            // Read (some of) the article
            driver.Wait(8);
            driver.ScrollPage(2);
            driver.Wait(2);
            driver.ScrollPage(2);
        }
コード例 #16
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager)
        {
            UserInfo credentials = credentialManager.GetCredentials("outlook.com");

            // Navigate
            driver.Navigate().GoToUrl("http://www.outlook.com");
            driver.Wait(5);

            // Log in
            driver.TypeIntoField(driver.FindElementById("i0116"), credentials.Username + Keys.Enter);
            driver.Wait(1);

            driver.TypeIntoField(driver.FindElementById("i0118"), credentials.Password + Keys.Enter);
            driver.Wait(5);

            // Cycle through some emails, simply with the down arrow key
            for (int i = 0; i < 5; i++)
            {
                driver.Keyboard.SendKeys(Keys.Down);
                driver.Wait(5);
            }

            // Compose a new email and send to a test account
            driver.ClickElement(driver.FindElement(By.XPath("//*[@title='Write a new message (N)']")));
            driver.Wait(3);

            driver.TypeIntoField("*****@*****.**" + Keys.Tab);
            driver.Wait(3);

            driver.TypeIntoField(driver.FindElement(By.XPath("//*[@aria-label='Subject,']")), "Subject" + Keys.Tab);
            driver.Wait(3);

            driver.TypeIntoField(driver.FindElement(By.XPath("//*[@aria-label='Message body']")), "This is a message.");
            driver.Wait(1);

            // Send the message with ctrl + Enter shortcut
            driver.Keyboard.PressKey(Keys.Control);
            driver.Keyboard.SendKeys(Keys.Enter);
            driver.Keyboard.ReleaseKey(Keys.Control);
            driver.Wait(5);

            // Arrow back up to the top
            for (int i = 0; i < 5; i++)
            {
                driver.Keyboard.SendKeys(Keys.Up);
                driver.Wait(2);
            }
        }
コード例 #17
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to about:blank
            var yaRu = "http://ya.ru";

            driver.NavigateToUrl(yaRu);

            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.Wait(1); // Keep for same time of tab displaying

                driver.NavigateToUrl(yaRu);
            }
        }
コード例 #18
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to static resource with content of http://ya.ru
            var staticYaRu = GetStaticResourceUrl();

            driver.NavigateToUrl(staticYaRu);

            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.Wait(1);  // Keep for same time of tab displaying

                driver.NavigateToUrl(staticYaRu);
            }
        }
コード例 #19
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the Microsoft Twitter page
            driver.NavigateToUrl("https://twitter.com/microsoft");
            driver.Wait(5);

            // On the first navigation to the page on a new device or after clearing the cookies, Twitter will open the login dropdown window.
            // Sending the keyboard escape key clears this and allows us to continue scrolling on the page.
            driver.SendKeys(Keys.Escape);
            driver.Wait(1);

            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Scroll down page");
            // Scroll through the infinite list
            driver.ScrollPage(16);
            ScenarioEventSourceProvider.EventLog.ScenarioActionStop("Scroll down page");
        }
コード例 #20
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to Yelp (Seattle)
            driver.NavigateToUrl("http://yelp.com/seattle");
            driver.Wait(5);

            // Search for dinner
            driver.TypeIntoField(driver.FindElementById("find_desc"), "Dueminuti Healthy Pasta" + Keys.Enter);
            driver.Wait(3);

            // Click into result
            driver.ClickElement(driver.FindElementByClassName("regular-search-result").FindElement(By.ClassName("biz-name")));
            driver.Wait(3);

            driver.ScrollPage(4);
        }
コード例 #21
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            var url = "https://ru.wikipedia.org/wiki/%D0%9D%D0%B5%D1%80%D0%B2%D0%B0";

            driver.NavigateToUrl(url);

            for (var i = 0; i < 9; i++)
            {
                driver.Wait(1);

                driver.CreateNewTab();
                driver.Wait(1);

                driver.NavigateToUrl(url);
            }
        }
コード例 #22
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Get the relevant username and password
            UserInfo credentials = credentialManager.GetCredentials("azure.com");

            // Go to the login
            driver.Navigate().GoToUrl("http://portal.azure.com");
            driver.Wait(3);

            // Log in
            driver.TypeIntoField(driver.FindElementById("cred_userid_inputtext"), credentials.Username);
            driver.TypeIntoField(driver.FindElementById("cred_password_inputtext"), credentials.Password + Keys.Enter);
            driver.Wait(8);

            // Open a blade
            var sidebar = driver.FindElementByClassName("fxs-sidebar-bar");

            driver.ClickElement(sidebar.FindElement(By.XPath("//*[@title='All resources']")));
            driver.Wait(10);

            // Open the marketplace
            driver.ClickElement(sidebar.FindElement(By.ClassName("fxs-sidebar-browse")));
            driver.Wait(2);

            driver.TypeIntoField(driver.FindElement(By.ClassName("fxs-sidebar-filter-input")), "marketplace" + Keys.Enter);
            driver.Wait(12);

            // Search for Visual studio
            driver.TypeIntoField(driver.FindElementByClassName("ext-gallery-search-container").FindElement(By.ClassName("azc-input")), "Visual studio" + Keys.Enter);
            driver.Wait(10);

            // Open more blades
            driver.ClickElement(sidebar.FindElement(By.XPath("//*[@title='Billing']")));
            driver.Wait(10);

            driver.ClickElement(sidebar.FindElement(By.XPath("//*[@title='Resource groups']")));
            driver.Wait(10);

            driver.ClickElement(sidebar.FindElement(By.XPath("//*[@title='App Services']")));
            driver.Wait(10);

            driver.ClickElement(sidebar.FindElement(By.XPath("//*[@title='SQL databases']")));
            driver.Wait(10);

            driver.ClickElement(sidebar.FindElement(By.XPath("//*[@title='Virtual machines']")));
            driver.Wait(10);
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to local static resource
            var indexHtml = GetStaticResourceUrl();

            driver.NavigateToUrl(indexHtml);

            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.CreateNewTab();
                driver.Wait(1);

                driver.NavigateToUrl(indexHtml);
            }
        }
コード例 #24
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the Instagram page for the NY public library
            driver.NavigateToUrl("https://www.instagram.com/nypl/");
            driver.Wait(5);

            driver.ScrollPage(2);

            // Start the infinite scrolling list by clicking on "load more"
            driver.ClickElement(driver.FindElement(By.XPath("//*[contains(text(), 'Load more')]")));
            driver.Wait(3);

            // Then scroll through it
            driver.ScrollPage(8);

            timer.ExtractPageLoadTime("Instagram account");
        }
コード例 #25
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            driver.NavigateToUrl("https://muni.cz");
            driver.WaitForPageLoad();

            driver.TypeIntoField(driver.FindElementById("search"), "Software Quality" + Keys.Enter);
            driver.WaitForPageLoad();
            driver.Wait(5);

            var elementToClick = driver.FindElementByXPath("//div[contains(@class, gsc-results)]" +
                                                           "/div[contains(@class, gsc-result)]" +
                                                           "/div[contains(@class, gs-result)]" +
                                                           "/div/div/a");

            driver.ClickElement(elementToClick);
            driver.WaitForPageLoad();
        }
コード例 #26
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            UserInfo credentials = credentialManager.GetCredentials("pinterest.com");

            // Nagivate to the Pintrest explore page
            driver.Navigate().GoToUrl("https://www.pinterest.com/");
            driver.Wait(5);

            // Log in
            driver.TypeIntoField(driver.FindElement(By.Name("id")), credentials.Username);
            driver.Wait(2);
            driver.TypeIntoField(driver.FindElement(By.Name("password")), credentials.Password + Keys.Enter);
            driver.Wait(8);

            // Scroll
            driver.ScrollPage(10);
        }
コード例 #27
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            driver.NavigateToUrl("https://www.muni.cz/");
            driver.Wait(5);

            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Fill search field");
            driver.TypeIntoField(driver.FindElementByCssSelector(".inp-fix.inp-icon.inp-icon--after input"),
                                 "Software Quality" + Keys.Enter);

            driver.Wait(10);

            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Click on the first result");
            driver.ClickElement(
                driver.FindElementByCssSelector(".gsc-results.gsc-webResult>.gsc-webResult.gsc-result a.gs-title"));

            timer.ExtractPageLoadTime();
        }
コード例 #28
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager)
        {
            driver.Navigate().GoToUrl("http://www.yahoo.com");
            driver.Wait(10);
            IWebElement newsLink = driver.FindElementByCssSelector("a[href$='yahoo.com/news/']");

            newsLink.SendKeys(String.Empty);
            newsLink.SendKeys(Keys.Enter);

            Thread.Sleep(10000);
            // Get the "mega" story and navigate to it
            // We appear to be taking advantage of a test hook in the page for their own tests
            IWebElement articleLink = driver.FindElementByCssSelector("div[data-test-locator=mega] h3 a");

            articleLink.SendKeys(String.Empty);
            articleLink.SendKeys(Keys.Enter);
        }
コード例 #29
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the homepage for Tumblr
            driver.NavigateToUrl("https://www.tumblr.com/explore/trending");
            driver.Wait(10);

            // Try changing content with content controls
            //     At the time of writing, this is interesting because it doesn't require an actual page load

            driver.ClickElement(driver.FindElementByClassName("l-header-container").FindElement(By.XPath("//*[@data-text='Staff picks']")));
            driver.Wait(10);
            driver.ClickElement(driver.FindElementByClassName("l-header-container").FindElement(By.XPath("//*[@data-text='Trending']")));
            driver.Wait(5);

            // Scroll through the infinite list
            driver.ScrollPage(10);
        }
コード例 #30
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager)
        {
            // Navigate
            driver.Navigate().GoToUrl("http://www.amazon.com");
            driver.Wait(5);

            // Type "Game of Thrones" in the search box and hit enter
            driver.TypeIntoField(driver.FindElementById("twotabsearchtextbox"), "Game of Thrones" + Keys.Enter);
            driver.Wait(5);

            // Click into "Game of Thrones Season 1"
            driver.ClickElement(driver.FindElementByXPath("//*[@title='Game of Thrones Season 1']"));
            driver.Wait(2);

            // Scroll down to reviews
            driver.ScrollPage(5);
        }