示例#1
0
        public void StartBrowser_LoginAndPerformChecks_StopBrowser()
        {
            selenium.NavigateTo("http://parabank.parasoft.com");

            selenium.SendKeys(By.Name("username"), "john");
            selenium.SendKeys(By.Name("password"), "demo");
            selenium.Click(By.XPath("//input[@value='Log In']"));

            /***
             * Rewrite the actions below so they use the helper methods in the SeleniumHelpers class
             * You'll need to define one helper method yourself, to perform the dropdown select action
             * All other helpers you'll need are there already
             */

            driver.FindElement(By.LinkText("Request Loan")).Click();
            driver.FindElement(By.Id("amount")).SendKeys("10000");
            driver.FindElement(By.Id("downPayment")).SendKeys("100");
            SelectElement dropdownFromAccountId = new SelectElement(driver.FindElement(By.Id("fromAccountId")));

            dropdownFromAccountId.SelectByText("54321");
            driver.FindElement(By.XPath("//input[@value='Apply Now']")).Click();

            string result = driver.FindElement(By.Id("loanStatus")).Text;

            Assert.AreEqual("Denied", result);
        }
        public void StartBrowser_PerformGoogleSearch_AssertOnResultPage_StopBrowser()
        {
            selenium.NavigateTo("https://www.google.com");

            selenium.SendKeys(By.Name("q"), "Thomsons Online Benefits");

            selenium.Click(By.Name("btnK"));

            Assert.IsTrue(selenium.TitleIsEqualTo("Thomsons Online Benefits - Google zoeken"));

            Assert.IsTrue(selenium.ElementIsVisible(By.Id("resultStats")));
        }
        public void StartBrowser_LoginAndPerformChecks_StopBrowser()
        {
            selenium.NavigateTo("http://parabank.parasoft.com");

            selenium.SendKeys(By.Name("username"), "john");
            selenium.SendKeys(By.Name("password"), "demo");
            selenium.Click(By.XPath("//input[@value='Log In']"));

            selenium.Click(By.LinkText("Request Loan"));
            selenium.SendKeys(By.Id("amount"), "10000");
            selenium.SendKeys(By.Id("downPayment"), "100");
            selenium.Select(By.Id("fromAccountId"), "54321");
            selenium.Click(By.XPath("//input[@value='Apply Now']"));

            Assert.AreEqual("Denied", selenium.GetElementText(By.Id("loanStatus")));
        }
 public LoginPage Load()
 {
     selenium.NavigateTo("http://parabank.parasoft.com");
     return(this);
 }
 public GoogleHomePage Load()
 {
     selenium.NavigateTo("https://www.google.com");
     return(this);
 }