Exemplo n.º 1
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");
        }
Exemplo n.º 2
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();
        }