public void ExtraElementInfoTest()
        {
            WebDriver.Navigate().GoToUrl("https://stratusbeta.com/");
            var    r = new ElementSe(WebDriver, By.TagName("body")).Links;
            LinkSe CreateSiteLink = new LinkSe(WebDriver, By.LinkText("Create New Site"));

            Assert.AreEqual(CreateSiteLink.Url, "https://stratusbeta.com/Site/Create");

            DivSe buttonsDiv = new DivSe(WebDriver, By.CssSelector("#wrapper div#content fieldset div.formButtons"));

            Assert.AreEqual(buttonsDiv.ClassName, "formButtons rightAlign");

            ButtonSe continueButton = new ButtonSe(WebDriver, By.Id("Continue"));

            Assert.AreEqual(continueButton.ElementTag, "input");
            Assert.AreEqual(continueButton.Value, "Continue");
            Assert.AreEqual(continueButton.Id, "Continue");
            Assert.AreEqual(continueButton.Type, "submit");

            continueButton.Click();

            CheckBoxSe rememberMeCheckBox = new CheckBoxSe(WebDriver, By.Id("rememberMe"));

            Assert.AreEqual(rememberMeCheckBox.Title, "Check this box if you would like us to remember your user name and password for 6 months.");
            Assert.AreEqual(rememberMeCheckBox.Name, "rememberMe");
            Assert.AreEqual(rememberMeCheckBox.IsChecked, false);

            rememberMeCheckBox.Click();
            Assert.AreEqual(rememberMeCheckBox.IsChecked, true);

            LabelSe rememberMeLabel = new LabelSe(WebDriver, By.CssSelector("#content form fieldset div.leftColumn div.field label.inline"));

            Assert.AreEqual(rememberMeLabel.For, "rememberMe");
            Assert.AreEqual(rememberMeLabel.Text, "Keep me signed in.");
        }
        public void ExtraElementInfoTest()
        {
            WebDriver.Navigate().GoToUrl("https://stratusbeta.com/");
            var r = new ElementSe(WebDriver, By.TagName("body")).Links;
            LinkSe CreateSiteLink = new LinkSe(WebDriver, By.LinkText("Create a new site"));
            Assert.AreEqual(CreateSiteLink.Url, "https://onrealm.org/Site/Create");

            DivSe buttonsDiv = new DivSe(WebDriver, By.CssSelector("#login form ul li div.buttons"));
            Assert.AreEqual(buttonsDiv.ClassName, "buttons");

            ButtonSe continueButton = new ButtonSe(WebDriver, By.Id("Continue"));
            Assert.AreEqual(continueButton.ElementTag, "input");
            Assert.AreEqual(continueButton.Value, "Continue");
            Assert.AreEqual(continueButton.Id, "Continue");
            Assert.AreEqual(continueButton.Type, "button");

            continueButton.Click();

            CheckBoxSe rememberMeCheckBox = new CheckBoxSe(WebDriver, By.Id("rememberMe"));
            Assert.AreEqual(rememberMeCheckBox.Title, "Check this box if you would like us to remember your user name and password for 6 months.");
            Assert.AreEqual(rememberMeCheckBox.Name, "rememberMe");
            Assert.AreEqual(rememberMeCheckBox.IsChecked, false);

            rememberMeCheckBox.Click();
            Assert.AreEqual(rememberMeCheckBox.IsChecked, true);

            LabelSe rememberMeLabel = new LabelSe(WebDriver, By.CssSelector("#login form ul.horizontal li p.buttons label"));
            Assert.AreEqual(rememberMeLabel.For, null);
            Assert.AreEqual(rememberMeLabel.Text, "Remember me");
        }
        public void ExtraElementInfoTest()
        {
            WebDriver.Navigate().GoToUrl("https://stratusbeta.com/");
            var    r = new ElementSe(WebDriver, By.TagName("body")).Links;
            LinkSe CreateSiteLink = new LinkSe(WebDriver, By.LinkText("Create a new site"));

            Assert.AreEqual(CreateSiteLink.Url, "https://onrealm.org/Site/Create");

            DivSe buttonsDiv = new DivSe(WebDriver, By.CssSelector("#login form ul li div.buttons"));

            Assert.AreEqual(buttonsDiv.ClassName, "buttons");

            ButtonSe continueButton = new ButtonSe(WebDriver, By.Id("Continue"));

            Assert.AreEqual(continueButton.ElementTag, "input");
            Assert.AreEqual(continueButton.Value, "Continue");
            Assert.AreEqual(continueButton.Id, "Continue");
            Assert.AreEqual(continueButton.Type, "button");

            continueButton.Click();

            CheckBoxSe rememberMeCheckBox = new CheckBoxSe(WebDriver, By.Id("rememberMe"));

            Assert.AreEqual(rememberMeCheckBox.Title, "Check this box if you would like us to remember your user name and password for 6 months.");
            Assert.AreEqual(rememberMeCheckBox.Name, "rememberMe");
            Assert.AreEqual(rememberMeCheckBox.IsChecked, false);

            rememberMeCheckBox.Click();
            Assert.AreEqual(rememberMeCheckBox.IsChecked, true);

            LabelSe rememberMeLabel = new LabelSe(WebDriver, By.CssSelector("#login form ul.horizontal li p.buttons label"));

            Assert.AreEqual(rememberMeLabel.For, null);
            Assert.AreEqual(rememberMeLabel.Text, "Remember me");
        }
        public void ExtraElementInfoTest()
        {
            WebDriver.Navigate().GoToUrl("https://stratusbeta.com/");
            var r = new ElementSe(WebDriver, By.TagName("body")).Links;
            LinkSe CreateSiteLink = new LinkSe(WebDriver, By.LinkText("Create New Site"));
            Assert.AreEqual(CreateSiteLink.Url, "https://stratusbeta.com/Site/Create");

            DivSe buttonsDiv = new DivSe(WebDriver, By.CssSelector("#wrapper div#content fieldset div.formButtons"));
            Assert.AreEqual(buttonsDiv.ClassName, "formButtons rightAlign");

            ButtonSe continueButton = new ButtonSe(WebDriver, By.Id("Continue"));
            Assert.AreEqual(continueButton.ElementTag, "input");
            Assert.AreEqual(continueButton.Value, "Continue");
            Assert.AreEqual(continueButton.Id, "Continue");
            Assert.AreEqual(continueButton.Type, "submit");

            continueButton.Click();

            CheckBoxSe rememberMeCheckBox = new CheckBoxSe(WebDriver, By.Id("rememberMe"));
            Assert.AreEqual(rememberMeCheckBox.Title, "Check this box if you would like us to remember your user name and password for 6 months.");
            Assert.AreEqual(rememberMeCheckBox.Name, "rememberMe");
            Assert.AreEqual(rememberMeCheckBox.IsChecked, false);

            rememberMeCheckBox.Click();
            Assert.AreEqual(rememberMeCheckBox.IsChecked, true);

            LabelSe rememberMeLabel = new LabelSe(WebDriver, By.CssSelector("#content form fieldset div.leftColumn div.field label.inline"));
            Assert.AreEqual(rememberMeLabel.For, "rememberMe");
            Assert.AreEqual(rememberMeLabel.Text, "Keep me signed in.");
        }
Example #5
0
        // This Test does not actually work. Just shows examples of how to use the classes.
        public void Class_Examples()
        {
            ElementSe ele = new ElementSe(WebDriver, By.Id("theId"));

            SelectListSe selectList = new SelectListSe(WebDriver, By.ClassName("theClassName"));

            selectList.SelectByText("theOption");

            bool   visible         = selectList.Displayed;
            string theSelectedItem = selectList.SelectedOption.Text;


            TableSe aTable = new TableSe(WebDriver, By.Id("anID"));

            // click cell 8 on row 4
            aTable.TableBody.Rows[5].Cells[9].Click();

            // clear the field and type Tiger in the first cell that contains Tigere in the first row that contains Cats
            aTable.TableBody.Rows.First(i => i.Text == "Cats").Cells.First(i => i.Text == "Tigere").ClearFirstSendKeys("Tiger");
        }
        // This Test does not actually work. Just shows examples of how to use the classes.
        public void Class_Examples()
        {
            ElementSe ele = new ElementSe(WebDriver, By.Id("theId"));

            SelectListSe selectList = new SelectListSe(WebDriver, By.ClassName("theClassName"));
            
            selectList.SelectByText("theOption");

            bool visible = selectList.Displayed;
            string theSelectedItem = selectList.SelectedOption.Text;


            TableSe aTable = new TableSe(WebDriver, By.Id("anID"));
            
            // click cell 8 on row 4
            aTable.TableBody.Rows[5].Cells[9].Click();

            // clear the field and type Tiger in the first cell that contains Tigere in the first row that contains Cats 
            aTable.TableBody.Rows.First(i => i.Text == "Cats").Cells.First(i => i.Text == "Tigere").ClearFirstSendKeys("Tiger");
        }
Example #7
0
        public void Loan_Calculator_Test_WITH_Comments()
        {
            WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

            //This just grabs the first element on the page with a classname of "pageHolder". In this case it is a div that holds the main page.
            ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));

            /* The next two lines of code essentially perform the same operations except by passing in the WebDriver as the first parameter
             * you are searching the entire page for the id that was passed into the second parameter.
             * by passing in the pageHolderDivClass that we obtained in the previous line of code, only the Page Holder Div is searched for the
             * id passed in the second parameter.   --- its useful when dealing with a page that contains alot of similiar divs. you can search one instead of all.*/
            ElementSe loanAmount_searchWholePage     = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
            ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));


            // Clears the text currently located in the field then writes 3000.00.
            loanAmount_searchPageHolderDiv.ClearFirstSendKeys("3000.00");

            SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

            // verify the selectlist is present on the page
            Assert.IsTrue(month.Exists);

            // change the selected option to "Aug"
            month.SelectByText("Aug");

            //Verify the selected option is "Aug"
            Assert.IsTrue(month.SelectedOption.Text == "Aug");

            // ok lets pretend that the calculate button did not have an id and there were more than one button with the classname of "smurf-btn"
            // We can search by using a LinQ statement.
            // Here we are search for an element with a classname of "smurf-btn" and a Value of "Calculate". --- We have to use value on this search because the button does not actually contain text.
            // I'm still working on the code. In a while you will be able to use:
            // ElementSe calcButton = new ElementSe(WebDriver, By.ClassName("smurf-btn"), i => i.Value == "Calculate"); -- instead of
            ElementSe calcButton = new ElementSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate");

            calcButton.Click();
        }
        public void Loan_Calculator_Test_WITH_Comments()
        {
            WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

            //This just grabs the first element on the page with a classname of "pageHolder". In this case it is a div that holds the main page.
            ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));

            /* The next two lines of code essentially perform the same operations except by passing in the WebDriver as the first parameter
               you are searching the entire page for the id that was passed into the second parameter.
               by passing in the pageHolderDivClass that we obtained in the previous line of code, only the Page Holder Div is searched for the
               id passed in the second parameter.   --- its useful when dealing with a page that contains alot of similiar divs. you can search one instead of all.*/
            ElementSe loanAmount_searchWholePage = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
            ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));


            // Clears the text currently located in the field then writes 3000.00.
            loanAmount_searchPageHolderDiv.ClearFirstSendKeys("3000.00");

            SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

            // verify the selectlist is present on the page
            Assert.IsTrue(month.Exists);

            // change the selected option to "Aug"
            month.SelectByText("Aug");

            //Verify the selected option is "Aug"
            Assert.IsTrue(month.SelectedOption.Text == "Aug");

            // ok lets pretend that the calculate button did not have an id and there were more than one button with the classname of "smurf-btn"
            // We can search by using a LinQ statement.
            // Here we are search for an element with a classname of "smurf-btn" and a Value of "Calculate". --- We have to use value on this search because the button does not actually contain text.
            // I'm still working on the code. In a while you will be able to use: 
            // ElementSe calcButton = new ElementSe(WebDriver, By.ClassName("smurf-btn"), i => i.Value == "Calculate"); -- instead of
            ElementSe calcButton = new ElementSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate");
            calcButton.Click();
        }
Example #9
0
        public void Loan_Calculator_Test_WITHOUT_Comments()
        {
            WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

            ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));

            ElementSe loanAmount_searchWholePage     = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
            ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));

            loanAmount_searchPageHolderDiv.ClearFirstSendKeys("3000.00");

            SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

            Assert.IsTrue(month.Exists);

            month.SelectByText("Aug");

            Assert.IsTrue(month.SelectedOption.Text == "Aug");


            ElementSe calcButton = new ElementSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate");

            calcButton.Click();
        }
Example #10
0
        public void WebDriver_Vs_WebDriverSEd()
        {
            //The same for both
            WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

            //Initializing******************************************************

            //webDriver
            //IWebElement pageHolderdivClass = WebDriver.findElement(By.ClassName("pageHolder"));
            //WebDriverSEd
            ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));

            //webDriver
            //IWebElement loanAmount_searchWholePage = WebDriver.findElement(By.Id("ctl00_well_DefaultUC_loanAmount"));
            //IWebElement loanAmount_searchPageHolderDiv = pageHolderdivClass.findElement(By.Id("ctl00_well_DefaultUC_loanAmount"));
            //WebDriverSEd
            ElementSe loanAmount_searchWholePage     = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
            ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));

            //Sending Keys******************************************************

            //WebDriver
            // pageHolderdivClass.Clear();
            // pageHolderdivClass.SendKeys("3000.00");
            //WebDriverSEd
            pageHolderdivClass.ClearFirstSendKeys("3000.00");

            // Using a SelectList***************************************************

            //webDriver
            //IWebElement month = WebDriver.findElement(By.Id("ctl00_well_DefaultUC_LoanMonth"));
            SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

            //WebDriver
            //SelectElement monthSelect = new SelectElement(month);
            //Assert.IsTrue(monthSelect.SelectedOption.Text == "Jan");
            //WebDriverSEd
            Assert.IsTrue(month.SelectedOption.Text == "Jan");

            //WebDriver
            //monthSelect.SelectListItem("Aug");
            //WebDriverSEd
            month.SelectByText("Aug");

            // Using LinQ Statements

            //WebDriver
            // There isnt a way to do LinQ statements in the webdriver therefore you would have to use the xpath or css selectors to find this element.
            //WebDriverSEd
            new ButtonSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate").Click();

            // Table

            //WebDriver
            //It would take a alot of code to do this in the webdriver
            //WebDriverSEd
            TableSe           table  = new TableSe(WebDriver, By.Id("savedQueries_table"));
            ImageSeCollection images = table.TableBody.FindRow(new FindRow("Girls Rule", 0)).Images;

            images[1].Click();
        }
        public void WebDriver_Vs_WebDriverSEd()
        {
            //The same for both
            WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

            //Initializing******************************************************

            //webDriver
            //IWebElement pageHolderdivClass = WebDriver.findElement(By.ClassName("pageHolder"));
            //WebDriverSEd
            ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));

            //webDriver
            //IWebElement loanAmount_searchWholePage = WebDriver.findElement(By.Id("ctl00_well_DefaultUC_loanAmount"));
            //IWebElement loanAmount_searchPageHolderDiv = pageHolderdivClass.findElement(By.Id("ctl00_well_DefaultUC_loanAmount"));
            //WebDriverSEd
            ElementSe loanAmount_searchWholePage = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
            ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));

            //Sending Keys******************************************************

            //WebDriver
            // pageHolderdivClass.Clear();
            // pageHolderdivClass.SendKeys("3000.00");
            //WebDriverSEd
            pageHolderdivClass.ClearFirstSendKeys("3000.00");

            // Using a SelectList***************************************************

            //webDriver
            //IWebElement month = WebDriver.findElement(By.Id("ctl00_well_DefaultUC_LoanMonth"));
            SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

            //WebDriver
            //SelectElement monthSelect = new SelectElement(month);
            //Assert.IsTrue(monthSelect.SelectedOption.Text == "Jan");
            //WebDriverSEd
            Assert.IsTrue(month.SelectedOption.Text == "Jan");

            //WebDriver
            //monthSelect.SelectListItem("Aug");
            //WebDriverSEd
            month.SelectByText("Aug");

            // Using LinQ Statements
            
            //WebDriver
            // There isnt a way to do LinQ statements in the webdriver therefore you would have to use the xpath or css selectors to find this element.
            //WebDriverSEd
            new ButtonSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate").Click();

            // Table 

            //WebDriver
            //It would take a alot of code to do this in the webdriver
            //WebDriverSEd
            TableSe table = new TableSe(WebDriver, By.Id("savedQueries_table"));
            ImageSeCollection images = table.TableBody.FindRow(new FindRow("Girls Rule", 0)).Images;
            images[1].Click();
        }
        public void Loan_Calculator_Test_WITHOUT_Comments()
        {
            WebDriver.Navigate().GoToUrl("http://www.bankrate.com/calculators/mortgages/loan-calculator.aspx");

            ElementSe pageHolderdivClass = new ElementSe(WebDriver, By.ClassName("pageHolder"));
            
            ElementSe loanAmount_searchWholePage = new ElementSe(WebDriver, By.Id("ctl00_well_DefaultUC_loanAmount"));
            ElementSe loanAmount_searchPageHolderDiv = new ElementSe(pageHolderdivClass, By.Id("ctl00_well_DefaultUC_loanAmount"));

            loanAmount_searchPageHolderDiv.ClearFirstSendKeys("3000.00");

            SelectListSe month = new SelectListSe(WebDriver, By.Id("ctl00_well_DefaultUC_LoanMonth"));

            Assert.IsTrue(month.Exists);

            month.SelectByText("Aug");

            Assert.IsTrue(month.SelectedOption.Text == "Aug");


            ElementSe calcButton = new ElementSe(WebDriver, By.ClassName("smurf-btn"), i => i.GetAttribute("value") == "Calculate");
            calcButton.Click();
        }