Example #1
0
        static void vlanConfiguration()
        {
            var modem = new Browser();

            var modemURL = "http://192.168.20.1/qinetsetup.html";
            modem.Navigate(modemURL);
            //    Console.Write("get url");
           //    modem.BasicAuthenticationLogin("Broadband Router","admin","admin");
            modem.BasicAuthenticationLogin("192.168.20.1", "admin", "admin");


            modem.Navigate(modemURL);
            //     Console.Write(modem.CurrentHtml);
            var html = modem.CurrentHtml;
            string sessionKey = getSessionID(html);
            // post wlan type
            modemURL = "http://192.168.20.1/qvdslwanmode.cgi?wanType=2&sessionKey=" + sessionKey;
            modem.Navigate(modemURL);
            html = modem.CurrentHtml;
            sessionKey = getSessionID(html);
            modemURL = "http://192.168.20.1/qvdslppp.cgi?ntwkPrtcl=0&enblOnDemand=0&pppTimeOut=0&enblv4=1&useStaticIpAddress=0&pppIpExtension=0&enblFirewall=1&enblNat=1&enblIgmp=1&keepalive=1&keepalivetime=5&alivemaxfail=30&enVlanMux=1&vlanMuxId=69&vlanMuxPr=0&enblPppDebug=0&maxMtu=1492&keepalive=0&enblv6=0&pppAuthErrorRetry=0&pppAuthMethod=0&sessionKey=" + sessionKey;
            modem.Navigate(modemURL);
            html = modem.CurrentHtml;
            sessionKey = getSessionID(html);
            modemURL = "http://192.168.20.1/qsetup.cmd?pppUserName=craignz&pppPassword=craigpassword&portId=0&ptmPriorityNorm=1&ptmPriorityHigh=1&connMode=1&burstsize=3000&enblQos=1&grpPrec=8&grpAlg=WRR&grpWght=1&prec=8&alg=WRR&wght=1&sessionKey=" + sessionKey;
            modem.Navigate(modemURL);
           

        }
 public void UsingBrowserDirect()
 {
     Browser b = new Browser();
     b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
     var found = b.Find("div", FindBy.Class, "issues_closed");
     Assert.That(found.TotalElementsFound == 3);
 }
Example #3
0
        static void Main(string[] args)

        {
           var modem = new Browser();
            var modemURL = "http://192.168.20.1/tr69cfg.html";
                modem.Navigate(modemURL);
            //    Console.Write("get url");
            //    modem.BasicAuthenticationLogin("Broadband Router","admin","admin");
            modem.BasicAuthenticationLogin("192.168.20.1", "admin", "admin");


            modem.Navigate(modemURL);
           //     Console.Write(modem.CurrentHtml);
            var html = modem.CurrentHtml;

            string pattern = @"var sessionKey='([^']+)';";
            Match match = Regex.Match(html, pattern);
            string sessionKey = match.Groups[1].Value;
           // Console.Write(sessionKey);
            sessionKey = getSessionID(html);
           // Console.Write(sessionKey);
           // Console.Read();
            // create response

            // tr69cfg.cgi?tr69cEnable=1&tr69cInformEnable=1&tr69cInformInterval=86402&tr69cAcsURL=http://acs.netcommwireless.com/cpe.php&tr69cAcsUser=cpe&tr69cAcsPwd=cpe&tr69cConnReqUser=cpe&tr69cConnReqPwd=cpe&tr69cConnReqPort=30005&tr69cNoneConnReqAuth=0&tr69cDebugEnable=0&tr69cBoundIfName=Any_WAN&sessionKey=1045881970

            var getstringACS = ACSConfigString(sessionKey);
            modemURL = modemURL + getstringACS;
            modem.Navigate(modemURL);
            vlanConfiguration();
            // need to do 4 posts to configure vlan
        }
		public void TestRussian()
		{
			Browser b = new Browser();
			b.Navigate("http://online3.anextour.ru/");

			var menuItem = b.Select(".mainmenu");
			Assert.That(menuItem.Value.Contains( "Поиск"), "Russian text not found");

		}
Example #5
0
 static bool LastRequestFailed(Browser browser)
 {
     if(browser.LastWebException != null)
     {
         browser.Log("There was an error loading the page: " + browser.LastWebException.Message);
         return true;
     }
     return false;
 }
		public void TestRussian()
		{
			Browser b = new Browser();
			b.Navigate("http://online3.anextour.ru/");

			var menuItem = b.Select(".menu_top div");
			Assert.That(menuItem.Value == "Турагентствам", "Russian text not found");

		}
Example #7
0
        public static void LoginEpiserverWebForms(string loginUrl, string username, string password)
        {
            var browser = new Browser();
            browser.Navigate(loginUrl);

            browser.Find("FullRegion_LoginControl_UserName").Value = username;
            browser.Find("FullRegion_LoginControl_Password").Value = password;
            browser.Find("FullRegion_LoginControl_Button1").Click();
            Instance = browser;
        }
		public void FindingDuplicatesAndNotFinding()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var anchor = driver.FindElement(By.TagName("a"));
			Assert.That(anchor.TagName == "a");

			Assert.Throws(typeof(NoSuchElementException), ()=>driver.FindElement(By.TagName("nosuchtag")));
		}
		public void Searching_Html_Root_Element_Should_Work()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));

			var rootElement = driver.FindElements(By.TagName("html"));
			Assert.NotNull(rootElement);
			Assert.That(rootElement.Count > 0);
		}
		private static Helper.BrowserWrapperWithLastRequest GetMockedBrowser()
		{
			Browser br = new Browser(Helper.GetAllways200RequestMocker(new List<Tuple<string, string>>()
				{
					Tuple.Create("link\\.htm$", "<html><body>Link: <a href=\"otherpage.htm\">link</a></body></html>"),
					Tuple.Create("^.*", "<html></html>"),
				}));
			
			Helper.BrowserWrapperWithLastRequest b = new Helper.BrowserWrapperWithLastRequest(br);
			return b;
		}
Example #11
0
 public static string GetArchiveHtmlByPost(string url)
 {
     var browser = new Browser();
     browser.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10";
     browser.Navigate(url);
     browser.ExtraFormValues.Add("__EVENTTARGET", "Archivepagecontrol2:ShowAll");
     var form = browser.Find("Form1");
     var newAction = "/CMS.Politi.Web/Templates/Content/" + form.XElement.GetAttribute("action");
     form.XElement.SetAttributeValue("action", newAction);
     form.SubmitForm();
     return browser.CurrentHtml;
 }
        public void ScrapeTrainings(
            IEnumerable<RawTraining> trainings, AuthenticationParameters authenticationParameters)
        {
            try
            {
                _driver = new Browser();

                Login(authenticationParameters);

                trainings.ToList().ForEach(ParseTraining);
            }
            finally
            {
                _driver.Close();
            }
        }
		public void UsingCheckboxes()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var checkbox1 = driver.FindElement(By.CssSelector(".cb-container #first-checkbox"));
			var checkbox2 = driver.FindElement(By.CssSelector(".cb-container #second-checkbox"));
			Assert.That(checkbox1.Selected, "Checkbox 1 should be selected");
			Assert.That(!checkbox2.Selected, "Checkbox 2 should not be selected");
			checkbox2.Click();
			Assert.That(checkbox1.Selected, "Checkbox 1 should still be selected");
			Assert.That(checkbox2.Selected, "Checkbox 2 should be selected");
			var checkbox1Label = driver.FindElement(By.CssSelector("label[for=first-checkbox]"));
			Assert.NotNull(checkbox1Label, "Label not found");
			checkbox1Label.Click();
			Assert.That(checkbox2.Selected, "Checkbox 2 should still be selected");
			Assert.That(!checkbox1.Selected, "Checkbox 1 should be not selected");
			
		}
		public void UsingRadioButtons()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var radio1 = driver.FindElement(By.CssSelector(".rb-container #first-radio"));
			var radio2 = driver.FindElement(By.CssSelector(".rb-container #second-radio"));
			var radio1Label = driver.FindElement(By.CssSelector("label[for=first-radio]"));
			Assert.That(radio1.Selected, "Radiobutton 1 should be selected");
			Assert.That(!radio2.Selected, "Radiobutton 2 should not be selected");
			radio2.Click();
			Assert.That(!radio1.Selected, "Radiobutton 1 should not be selected");
			Assert.That(radio2.Selected, "Radiobutton 2 should be selected");
			Assert.NotNull(radio1Label, "Label not found");
			radio1Label.Click();
			Assert.That(radio1.Selected, "Radiobutton 1 should be selected");
			Assert.That(!radio2.Selected, "Radiobutton 2 should be not selected");

		}
        public void SearchingInKnownDocument()
        {
            Browser b = new Browser();
            b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
            IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));

            var iconSpans = driver.FindElements(By.CssSelector("span.icon"));
            Assert.That(iconSpans.Count == 4, "There should be 4 spans with class icon");

            var accountSettings = driver.FindElements(By.CssSelector("*[title~= Account]"));
            Assert.That(accountSettings.Count == 1 && accountSettings[0].Text == "Account Settings", "There should be 1 element with title containing the word Account");

            var topStuff = driver.FindElements(By.CssSelector("*[class|=top]"));
            Assert.That(topStuff.Count == 3 , "There should be 3 elements with class starting with top-");

            var h2s = driver.FindElements(By.CssSelector("h2"));
            Assert.That(h2s.Count == 8, "There should be 8 h2 elements");

            var titleContainingTeun = driver.FindElements(By.CssSelector("*[title*=Teun]"));
            Assert.That(titleContainingTeun.Count == 3, "There should be 3 elements with 'Teun' somewhere in the title attrbute");
        }
Example #16
0
		public void UsingLinks()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.SimpleForm.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var link = driver.FindElement(By.CssSelector("a.clickLink"));
			string lastRequest = "";
			b.RequestLogged += (browser, logged) =>
			{
				Console.WriteLine("Request logged: " + logged.Url.ToString());
				lastRequest = logged.Url.ToString();
			};
			link.Click();
			Assert.That(lastRequest.Contains("www.google.com/search"), "Link has resulted in unexpected request");

			b.SetContent(Helper.GetFromResources("DriverTest.SimpleForm.htm"));
			link = driver.FindElement(By.CssSelector("a.link-relative"));
			link.Click();
			Assert.That(lastRequest.Contains("/search"), "Link has resulted in unexpected request");
			
		}
        public void UsingSelectBoxes()
        {
            Browser b = new Browser();
            b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
            IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
            var selectbox = driver.FindElement(By.Name("sel"));
            var box = new SelectElement(selectbox);
            Assert.That(box.SelectedOption.Text == "two");
            box.SelectByValue("3");
            Assert.That(box.SelectedOption.Text == "three");
            box.SelectByText("one");
            Assert.That(box.SelectedOption.Text == "one");

			selectbox = driver.FindElement(By.Name("sel_multi"));
			box = new SelectElement(selectbox);
			Assert.That(box.IsMultiple);
			box.SelectByValue("3");
			box.SelectByText("one");
			Assert.That(box.AllSelectedOptions.Count == 3);

		}
Example #18
0
 static void OnBrowserMessageLogged(Browser browser, string log)
 {
     Console.WriteLine(log);
 }
Example #19
0
		public void SubmitGetForm()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.SimpleForm.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var form = driver.FindElement(By.CssSelector("form"));
			string lastRequest = "";
			b.RequestLogged += (browser, logged) =>
				{
					Console.WriteLine("Request logged: " + logged.Url.ToString());
					lastRequest = logged.Url.AbsoluteUri;
				};
			form.Submit();
			Assert.That(lastRequest.Contains("radios=first"), "Radio buttons not in correct state");
			// NOTE: this line seems wrong: the line breaks in a textarea should remain preserved. But, XML parsing will remove this.
			//       What are the actual rules around this
			Assert.That(lastRequest.Contains("textarea_a=This+is+a+full+text+part%0d%0awith"), "Textarea not posted correctly");

			var firstRadio = driver.FindElement(By.Id("first-radio"));
			var firstRadioLabel = driver.FindElement(By.CssSelector("label[for=first-radio]"));
			var secondRadio = driver.FindElement(By.Id("second-radio"));
			secondRadio.Click();
			form.Submit();
			Assert.That(lastRequest.Contains("radios=second"), "Radio buttons not in correct state");

			firstRadioLabel.Click();
			form.Submit();
			Assert.That(lastRequest.Contains("radios=first"), "Radio buttons not in correct state");

			var selectBox = driver.FindElement(By.Id("optionsList"));
			var box = new SelectElement(selectBox);
			Assert.That(box.AllSelectedOptions.Count == 1, "First option should be selected in selectbox");
			form.Submit();
			Assert.That(lastRequest.Contains("optionsList=opt1"), "Selectbox not in correct state");

			Assert.That(!lastRequest.Contains("submitButton=button1"), "Value of submit button should not be posted");
			var submitButton = driver.FindElement(By.CssSelector("input[type=submit]"));
			submitButton.Click();
			Assert.That(lastRequest.Contains("submitButton=button1"), "Value of submit button not posted");
		}
		public void SubmitPostForm()
		{
			Browser b = new Browser(Helper.GetAllways200RequestMocker());
			b.SetContent(Helper.GetFromResources("DriverTest.SimplePostForm.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var form = driver.FindElement(By.CssSelector("form"));
			NameValueCollection lastRequest = null;
			b.RequestLogged += (browser, logged) =>
			{
				Console.WriteLine("Request logged: " + logged.Url.ToString());
				lastRequest = logged.PostData;
			};
			form.Submit();
			Assert.That(lastRequest.AllKeys.Contains("radios") && lastRequest["radios"].Contains("first"), "Radio buttons not in correct state");
			// NOTE: this line seems wrong: the line breaks in a textarea should remain preserved. But, XML parsing will remove this.
			//       What are the actual rules around this
			//Assert.That(lastRequest.AllKeys.Contains("textarea_a") && lastRequest["textarea_a"].Contains("This is a full text part\r\nwith"), "Textarea not posted correctly");

      b.SetContent(Helper.GetFromResources("DriverTest.SimplePostForm.htm"));
      form = driver.FindElement(By.CssSelector("form"));
      var firstRadio = driver.FindElement(By.Id("first-radio"));
			var firstRadioLabel = driver.FindElement(By.CssSelector("label[for=first-radio]"));
			var secondRadio = driver.FindElement(By.Id("second-radio"));
			secondRadio.Click();
			form.Submit();
			Assert.That(lastRequest.AllKeys.Contains("radios") && lastRequest["radios"].Contains("second"), "Radio buttons not in correct state");

      b.SetContent(Helper.GetFromResources("DriverTest.SimplePostForm.htm"));
      form = driver.FindElement(By.CssSelector("form"));
      firstRadioLabel = driver.FindElement(By.CssSelector("label[for=first-radio]"));
      firstRadioLabel.Click();
			form.Submit();
			Assert.That(lastRequest.AllKeys.Contains("radios") && lastRequest["radios"].Contains("first"), "Radio buttons not in correct state");

      b.SetContent(Helper.GetFromResources("DriverTest.SimplePostForm.htm"));
      form = driver.FindElement(By.CssSelector("form"));
      var selectBox = driver.FindElement(By.Id("optionsList"));
			var box = new SelectElement(selectBox);
			Assert.That(box.AllSelectedOptions.Count == 1, "First option should be selected in selectbox");
			form.Submit();
			Assert.That(lastRequest.AllKeys.Contains("optionsList") && lastRequest["optionsList"].Contains("opt1"), "Selectbox not in correct state");


			Assert.That(!lastRequest.AllKeys.Contains("submitButton"), "Value of submit button should not be posted");

      b.SetContent(Helper.GetFromResources("DriverTest.SimplePostForm.htm"));
      var submitButton = driver.FindElement(By.CssSelector("input[type=submit]"));
			submitButton.Click();
			Assert.That(lastRequest.AllKeys.Contains("submitButton") && lastRequest["submitButton"].Contains("button1"), "Value of submit button not posted");

			Assert.That(!lastRequest.AllKeys.Contains("submitButton2"), "Value of submit button should not be posted");

      b.SetContent(Helper.GetFromResources("DriverTest.SimplePostForm.htm"));
      submitButton = driver.FindElement(By.CssSelector("button[type=submit]"));
			submitButton.Click();
			Assert.That(lastRequest.AllKeys.Contains("submitButton2") && lastRequest["submitButton2"].Contains("button2"), "Value of submit button not posted");
		}
		public void PostAspnetPostbackForm()
		{
			Browser b = new Browser(Helper.GetAllways200RequestMocker());
			b.SetContent(Helper.GetFromResources("DriverTest.PostbackForm.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var form = driver.FindElement(By.CssSelector("form"));
			NameValueCollection lastRequest = null;
			b.RequestLogged += (browser, logged) =>
			{
				Console.WriteLine("Request logged: " + logged.Url.ToString());
				lastRequest = logged.PostData;
			};
			var postbackLink = driver.FindElement(By.Id("postbackLink"));
			postbackLink.Click();
			Assert.That(lastRequest.AllKeys.Contains("__EVENTTARGET") && lastRequest["__EVENTTARGET"].Contains("colorBox"), "colorBox was not indicated as the postback target");
		}
		public void UsingTextareas()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.SimpleForm.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var textbox = driver.FindElement(By.Name("textarea_a"));
			Assert.That(textbox != null);
			Assert.That(textbox.Text.Contains("\n"), "Textarea should not make line breaks coalesce into space");
		}
		public void UsingHtml5Inputs()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.SimpleForm.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var colorBox = driver.FindElement(By.Id("colorBox"));
			Assert.NotNull(colorBox, "Couldn't find colorbox");
			colorBox.SendKeys("ff0000");
			Assert.AreEqual(colorBox.Text, "ff0000", "Colorbox did not pick up sent keys");

			var form = driver.FindElement(By.CssSelector("form"));
			string lastRequest = "";
			b.RequestLogged += (browser, logged) =>
			{
				Console.WriteLine("Request logged: " + logged.Url.ToString());
				lastRequest = logged.Url.AbsoluteUri;
			};
			form.Submit();
			Assert.That(lastRequest.Contains("colorBox=ff0000"), "Color box not posted correctly");
		}
Example #24
0
        static void Main(string[] args)
        {
            var browser = new Browser();
            try
            {
                // log the browser request/response data to files so we can interrogate them in case of an issue with our scraping
                browser.RequestLogged += OnBrowserRequestLogged;
                browser.MessageLogged += new Action<Browser, string>(OnBrowserMessageLogged);

                // we'll fake the user agent for websites that alter their content for unrecognised browsers
                browser.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10";

                // browse to GitHub
                browser.Navigate("http://github.com/");
                if(LastRequestFailed(browser)) return; // always check the last request in case the page failed to load

                // click the login link and click it
                browser.Log("First we need to log in, so browse to the login page, fill in the login details and submit the form.");
                var loginLink = browser.Find("a", FindBy.Text, "Login");
                if(!loginLink.Exists)
                    browser.Log("Can't find the login link! Perhaps the site is down for maintenance?");
                else
                {
                    loginLink.Click();
                    if(LastRequestFailed(browser)) return;

                    // fill in the form and click the login button - the fields are easy to locate because they have ID attributes
                    browser.Find("login_field").Value = "*****@*****.**";
                    browser.Find("password").Value = "yourpassword";
                    browser.Find(ElementType.Button, "name", "commit").Click();
                    if(LastRequestFailed(browser)) return;

                    // see if the login succeeded - ContainsText() is very forgiving, so don't worry about whitespace, casing, html tags separating the text, etc.
                    if(browser.ContainsText("Incorrect login or password"))
                    {
                        browser.Log("Login failed!", LogMessageType.Error);
                    }
                    else
                    {
                        // After logging in, we should check that the page contains elements that we recognise
                        if(!browser.ContainsText("Your Repositories"))
                            browser.Log("There wasn't the usual login failure message, but the text we normally expect isn't present on the page");
                        else
                        {
                            browser.Log("Your News Feed:");
                            // we can use simple jquery selectors, though advanced selectors are yet to be implemented
                            foreach(var item in browser.Select("div.news .title"))
                                browser.Log("* " + item.Value);
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                browser.Log(ex.Message, LogMessageType.Error);
                browser.Log(ex.StackTrace, LogMessageType.StackTrace);
            }
            finally
            {
                var path = WriteFile("log-" + DateTime.UtcNow.Ticks + ".html", browser.RenderHtmlLogFile("SimpleBrowser Sample - Request Log"));
                Process.Start(path);
            }
        }
		public void UsingTextboxes()
		{
			Browser b = new Browser();
			b.SetContent(Helper.GetFromResources("DriverTest.GitHub.htm"));
			IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(b));
			var textbox = driver.FindElement(By.CssSelector("#your-repos-filter"));
			Assert.NotNull(textbox, "Couldn't find textbox");
			Assert.That(textbox.Text == String.Empty, "Textbox without a value attribute should have empty text");
			textbox.SendKeys("test text");
			Assert.That(textbox.Text == "test text", "Textbox did not pick up sent keys");
			textbox.SendKeys(" more");
			Assert.That(textbox.Text == "test text more", "Textbox did not append second text");
			textbox.Clear();
			Assert.That(textbox.Text == String.Empty, "Textbox after Clear should have empty text");
		}
Example #26
0
 XDocument GetWindow(string url)
 {
     var browser = new Browser();
     browser.Navigate(url);
     return browser.XDocument;
 }
			public BrowserWrapperWithLastRequest(Browser b):base(b)
			{
				b.RequestLogged += new Action<Browser, HttpRequestLog>(HandleRequestLogged);
			}
			void HandleRequestLogged(Browser b, HttpRequestLog req)
			{
				this.LastRequest = req;
			}
Example #29
0
 static void OnBrowserRequestLogged(Browser req, HttpRequestLog log)
 {
     Console.WriteLine(" -> " + log.Method + " request to " + log.Url);
     Console.WriteLine(" <- Response status code: " + log.ResponseCode);
 }
Example #30
0
        static void Main(string[] args)
        {
            var browser = new Browser();
            try
            {
                // log the browser request/response data to files so we can interrogate them in case of an issue with our scraping
                browser.RequestLogged += OnBrowserRequestLogged;
                browser.MessageLogged += new Action<Browser, string>(OnBrowserMessageLogged);

                // we'll fake the user agent for websites that alter their content for unrecognised browsers
                browser.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10";

                // browse to GitHub
                browser.Navigate("http://www.pogdesign.co.uk/cat/");
                if (LastRequestFailed(browser)) return; // always check the last request in case the page failed to load

                browser.Log("First we need do find a Title with month and year description.");

                var titleLink = browser.Find("a", FindBy.Text, "August 2016 TV Episode Calendar");
                if (!titleLink.Exists)
                {
                    browser.Log("Can't find the link! Perhaps the site is down for maintenance?");
                    return;
                }

                browser.Log("Then we find the yesterday column.");

                // Obter dia
                var dayDiv = browser.Find("div", FindBy.Id, "d_1_8_2016");
                if (!dayDiv.Exists)
                {
                    browser.Log("Can't find the column! Perhaps dont have any series for the month.");
                    return;
                }

                var serieLink = browser.Find("a href", FindBy.PartialText, "-summary");
                if (serieLink.Exists)
                {
                    Console.WriteLine(serieLink.TotalElementsFound);

                    Console.WriteLine(serieLink.FirstOrDefault().Value);
                }

                //// click the login link and click it
                //browser.Log("First we need to log in, so browse to the login page, fill in the login details and submit the form.");
                //var loginLink = browser.Find("a", FindBy.Text, "Login");
                //if (!loginLink.Exists)
                //    browser.Log("Can't find the login link! Perhaps the site is down for maintenance?");
                //else
                //{
                //    loginLink.Click();
                //    if (LastRequestFailed(browser)) return;

                    //    // fill in the form and click the login button - the fields are easy to locate because they have ID attributes
                    //    browser.Find("login_field").Value = "*****@*****.**";
                    //    browser.Find("password").Value = "yourpassword";
                    //    browser.Find(ElementType.Button, "name", "commit").Click();
                    //    if (LastRequestFailed(browser)) return;

                    //    // see if the login succeeded - ContainsText() is very forgiving, so don't worry about whitespace, casing, html tags separating the text, etc.
                    //    if (browser.ContainsText("Incorrect login or password"))
                    //    {
                    //        browser.Log("Login failed!", LogMessageType.Error);
                    //    }
                    //    else
                    //    {
                    //        // After logging in, we should check that the page contains elements that we recognise
                    //        if (!browser.ContainsText("Your Repositories"))
                    //            browser.Log("There wasn't the usual login failure message, but the text we normally expect isn't present on the page");
                    //        else
                    //        {
                    //            browser.Log("Your News Feed:");
                    //            // we can use simple jquery selectors, though advanced selectors are yet to be implemented
                    //            foreach (var item in browser.Select("div.news .title"))
                    //                browser.Log("* " + item.Value);
                    //        }
                    //    }
                    //}
            }
            catch (Exception ex)
            {
                browser.Log(ex.Message, LogMessageType.Error);
                browser.Log(ex.StackTrace, LogMessageType.StackTrace);
            }
            finally
            {
                var path = WriteFile("log-" + DateTime.UtcNow.Ticks + ".html", browser.RenderHtmlLogFile("SimpleBrowser Sample - Request Log"));
                //Process.Start(path);
            }

            Console.ReadKey();
        }