Esempio n. 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string user = username.Text;
            string pass = password.Password;

            rec = recemail.Text;
            var Page2 = new PaymentConfirmOTP();
            var Page3 = new LoginOTP();
            var ec    = new EnterCredentials();

            LibraryUtils.EmailLogin(user, pass);

            if (LibraryUtils.IsElementPresent(By.XPath("//span[contains(text(), 'Incorrect')]")))
            {
                MessageBox.Show("Invalid sign-in details. Please try again");
            }
            else if (LibraryUtils.IsElementPresent(By.XPath("//input[@id = 'otp']")))
            {
                Page3.Show();
                this.Close();
            }
            else if (LibraryUtils.IsElementPresent(By.XPath("//span[text() = 'PAY']")))
            {
                LibraryUtils.conBen(rec);
                LibraryUtils.money();
                LibraryUtils.aftermoney();
                this.Close();
            }
        }
Esempio n. 2
0
    //Check should be pplaced to see if the user has enough credit for transaction, if they do not they should be notified  they don't have funds in account
    public static void aftermoney()
    {
        var Page2 = new easyeftthc.PaymentConfirmOTP();

        if (LibraryUtils.IsElementPresent(By.XPath("//span[text() = 'The amount exceeds your available balance']")))
        {
            LibraryUtils.driver.Quit();
        }
        else
        {
            LibraryUtils.conPay();
            Page2.Show();
        }
    }
Esempio n. 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string otp   = logOTP.Password;
            var    Page2 = new PaymentConfirmOTP();

            LibraryUtils.loginOTP(otp);

            if (LibraryUtils.IsElementPresent(By.XPath("//span[text() = 'PAY']")))
            {
                LibraryUtils.conBen(EnterCredentials.rec);
                LibraryUtils.money();
            }

            if (LibraryUtils.IsElementPresent(By.XPath("//span[text() = 'The amount exceeds your available balance']")))
            {
                LibraryUtils.driver.Quit();
            }
            else
            {
                LibraryUtils.conPay();
                Page2.Show();
                this.Close();
            }
        }
Esempio n. 4
0
    //public static string rec;



    //Mehtod should be called after user enters credentialss and clicks the login button
    public static void EmailLogin(String email, String password)
    {
        FirefoxOptions option = new FirefoxOptions();

        option.AddArguments("--headless", "--disable-gpu", "--window-size=1200,900");
        //System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", @"C:\EFT\chromedriver.exe");
        //driver = new ChromeDriver("C:\\EFT", option);
        //var service = ChromeDriverService.CreateDefaultService(AppDomain.CurrentDomain.BaseDirectory);
        //Convert.ToString(service);
        //option.BinaryLocation = "C:\\Users\\Public\\chromedriver.exe";
        //string opt = Convert.ToString(service);
        //opt += @".chromedriver";
        //option.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe";
        //System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", "C:\\Users\\Public\\chromedriver.exe");
        // ChromeOptions opts = new ChromeOptions();
        // opts.AddExcludedArgument("enable-automation");
        //opts.AddAdditionalCapability("useAutomationExtension", false);
        driver = new FirefoxDriver(/*service,*/ option);

        //driver.Navigate().GoToUrl("https://onlinebanking.standardbank.co.za/#/login?intcmp=coza-sitewide-headernav-direct-login");
        driver.Navigate().GoToUrl("https://onlinebanking.standardbank.co.za/#/login");
        WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

        //Credentials will be called from login credentials page
        wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//input[@id = 'username']"))).SendKeys(email);

        wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[text() = 'Next']"))).Click();

        if (LibraryUtils.IsElementPresent(By.XPath("//span[text() = 'Sign In With Password']/..")))
        {
            wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//span[text() = 'Sign In With Password']/.."))).Click();
        }
        wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//input[@type = 'password']"))).SendKeys(password);

        wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//span[text() = 'Sign in']/.."))).Click();
    }