示例#1
0
        protected override void DoLogin()
        {
            InitSeleniumDriver();
            WebDriver.Navigate().GoToUrl(@"https://mybank.icbc.com.cn/icbc/enperbank/index.jsp");

            Console.WriteLine("start");

            WebDriver.SwitchTo().Frame("indexFrame");
            var userNameTextbox = WaitDriver.Until(ExpectedConditions.ElementIsVisible(By.Id("logonCardNum")));

            userNameTextbox.SendKeys("asdfr159");

            var logonPasswordPoint = GetLogonPasswordPoint();

            Input.MoveMouseTo((int)logonPasswordPoint.X, (int)logonPasswordPoint.Y);
            Input.SendLeftClick();
            Input.KeyPressDelay = 50; // See below for explanation; not necessary in non-game apps
            Input.SendText("aa485412");

            Thread.Sleep(100);

            var verificationCodePoint = GetVerificationCodePoint();

            Input.MoveMouseTo((int)verificationCodePoint.X, (int)verificationCodePoint.Y);
            Input.SendLeftClick();
            var cookies         = GetCookiesFromSeleniumDriver();
            var urlVerification = GetVerificationUrl();
            var captcha         = CaptchaRecognizer.GetICBCCaptcha(urlVerification, cookies);

            Input.SendText(captcha);
            var loginElement = WaitDriver.Until(ExpectedConditions.ElementToBeClickable(By.Id("submitaid")));

            loginElement.Click();
        }
        public void SuccessAlert()
        {
            var wait = new WebDriverWait(Driver.driver, new TimeSpan(0, 0, 10));

            wait.Until(WaitDriver => WaitDriver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]")).Text.Contains("Availability updated"));
            IWebElement ValueAlert = Driver.driver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]"));

            Assert.AreEqual(ValueAlert.Text, "Availability updated");
        }
        public void CreateAccount(Account account)
        {
            driver.FindElement(txtEmail).SendKeys(account.Email);
            driver.FindElement(btnSubmit).Click();
            WaitDriver.WaitForElement(driver, txtFirstName);
            driver.FindElement(txtFirstName).SendKeys(account.FirstName);
            driver.FindElement(txtLastName).SendKeys(account.LastName);
            driver.FindElement(txtPass).SendKeys(account.Password);
            driver.FindElement(txtAddress).SendKeys(account.Address);
            driver.FindElement(txtCity).SendKeys(account.City);
            var cboState = new SelectElement(driver.FindElement(By.Id("id_state")));

            cboState.SelectByText(account.State);
            driver.FindElement(txtPostal).SendKeys(account.PostalCode);
            var cboCountry = new SelectElement(driver.FindElement(By.Id("id_country")));

            cboCountry.SelectByText(account.Country);
            driver.FindElement(txtPhone).SendKeys(account.Phone);
            driver.FindElement(txtAlias).SendKeys(account.Alias);
            driver.FindElement(btnSubmitAccount).Click();
        }
示例#4
0
        public void PressUpdateButton()
        {
            //pressing the update button and then click
            IWebElement UpdtLanguageBtn = Driver.driver.FindElement(By.XPath("(//input[@value='Update'])[1]"));

            UpdtLanguageBtn.Click();

            //Assert that the values have been properly accepted by the system
            var wait = new WebDriverWait(Driver.driver, new TimeSpan(0, 0, 10));

            wait.Until(WaitDriver => WaitDriver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]")));
            wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[contains(@class,'ns-box-inner')]")));
            IWebElement ValueAlert = Driver.driver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]"));

            Driver.TurnOnWait();
            Assert.AreEqual(ValueAlert.Text, "Hindi has been updated to your languages");
            IWebElement ValueClose = Driver.driver.FindElement(By.XPath("//a[contains(@class,'ns-close')]"));

            ValueClose.Click();
            Driver.TurnOnWait();
        }
示例#5
0
        public void PressAddButton()

        {
            //Identifying the add button, click , sending value
            Driver.TurnOnWait();
            IWebElement languageadd = Driver.driver.FindElement(By.XPath("(//input[contains(@value,'Add')])"));

            languageadd.Click();

            //Assert that the values have been properly accepted by the system
            var wait = new WebDriverWait(Driver.driver, new TimeSpan(0, 0, 10));

            wait.Until(WaitDriver => WaitDriver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]")));
            wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[contains(@class,'ns-box-inner')]")));
            IWebElement ValueAlert = Driver.driver.FindElement(By.XPath("//div[contains(@class,'ns-box-inner')]"));

            Driver.TurnOnWait();
            Assert.AreEqual(ValueAlert.Text, "Bengali has been added to your languages");
            IWebElement ValueClose = Driver.driver.FindElement(By.XPath("//a[contains(@class,'ns-close')]"));

            ValueClose.Click();
            Driver.TurnOnWait();
        }