internal void ConnectToBank() { onlineAccounts.WaitForGetBankList(); for (int retries = 5; retries > 0; retries--) { onlineAccounts.Name = OnlineBankName; onlineAccounts.Institution = "bankofhope"; onlineAccounts.FID = "1234"; onlineAccounts.OfxAddress = OfxServerUrl; onlineAccounts.AppId = "QWIN"; onlineAccounts.AppVersion = "1700"; if (onlineAccounts.IsButtonEnabled("ButtonVerify")) { // give connect button time to react... passwordDialog = onlineAccounts.ClickConnect(); if (passwordDialog != null) { return; } } else { // sometimes the setting of the properties doesn't work! Thread.Sleep(250); } } throw new Exception("Can't seem to get the connect button to work"); }
internal void AnswerChallenge() { challengeDialog.SetUserDefinedField("MFA13", "1234"); challengeDialog.SetUserDefinedField("123", "Newcastle"); challengeDialog.SetUserDefinedField("MFA16", "Aston"); challengeDialog.ClickOk(); challengeDialog = null; }
internal void SignOnToBank() { ofxServerWindow.UserName = passwordDialog.UserName = "******"; ofxServerWindow.Password = passwordDialog.Password = "******"; bool mfa = false; if (random.Next(0, 2) == 0) { // turn on MFA challenge ofxServerWindow.MFAChallengeRequired = mfa = true; } else { // turn it off by selecting something else. ofxServerWindow.UseAdditionalCredentials = true; } passwordDialog.ClickOk(); passwordDialog = null; // give the old password dialog time to go away! Thread.Sleep(1000); AutomationElement challenge = onlineAccounts.Element.FindFirstWithRetries(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, "PasswordDialog"), 10, 500); if (mfa && challenge == null) { throw new Exception("Where is the challenge dialog?"); } if (challenge != null) { if (challenge.Current.Name.Contains("Multi")) { challengeDialog = new PasswordDialogWrapper(challenge); } else if (mfa) { throw new Exception("The challenge dialog didn't have the expected name, found: '" + challenge.Current.Name + "'"); } } }