private void StartScript() { m_errorContent.ClearErrors(); m_outputContent.Clear(); m_outputContent.Show(dockPanel); if (m_windowMgr.HasEditor) { m_windowMgr.ActiveEditor.Show(dockPanel); } m_scriptMgr.Execute(); }
/// <summary> /// Starts endless loop executing all enabled scripts /// Supports cancellationToken /// </summary> private void StartLoop() { token = new CancellationTokenSource(); var canellationToken = token.Token; mainLoop = Task.Factory.StartNew(() => { while (true) { canellationToken.ThrowIfCancellationRequested(); try { _sm.Execute(); } catch (Exception e) { MessageBox.Show(e.ToString()); } Thread.Sleep(50); } }, canellationToken); }
public void Login(ILoginCredentials credentials) { _credentials = credentials as BarclaysLoginCredentials; browserBot.WebDriver.Url = Urls.Login; browserBot.WebDriver.Navigate(); //_browserBot.WebDriver.FindElement(By.Id("surname")).SendKeys(_credentials.Surname); //// Chosen to use membership number //if (_credentials.MembershipNumber != null) //{ // _browserBot.WebDriver.FindElement(By.Id("membership-radio")).Click(); // _browserBot.WebDriver.FindElement(By.Id("membership-num")).SendKeys(_credentials.MembershipNumber); //} //// Chosen to use card number //else if (_credentials.CardNumber != null) //{ // _browserBot.WebDriver.FindElement(By.Id("card-radio")).Click(); // var cardSplit = AccountHelpers.SplitCardNumber(_credentials.CardNumber); // for (var i = 0; i < 4; i++) // { // var fieldId = $"debitCardSet{i + 1}"; // _browserBot.WebDriver.FindElement(By.Id(fieldId)).SendKeys(cardSplit[i]); // } //} //// Chosen to use account details //else if (_credentials.SortCode != null || _credentials.AccountNumber != null) //{ // _browserBot.WebDriver.FindElement(By.Id("account-radio")).Click(); // var sortcodeSplit = AccountHelpers.SplitSortCode(_credentials.SortCode); // for (var i = 0; i < 3; i++) // { // var fieldId = $"sortCodeSet{i + 1}"; // _browserBot.WebDriver.FindElement(By.Id(fieldId)).SendKeys(sortcodeSplit[i]); // } //} //else //{ // throw new InvalidOperationException("Could not determine login procedure from given properties."); //} //// Advance to stage 2 //_browserBot.WebDriver.FindElement(By.Id("forward")).Click(); //_browserBot.WebDriver.FindElement(By.Id("passcode-radio")).Click(); //_browserBot.WebDriver.FindElement(By.Id("passcode")).SendKeys(_credentials.Passcode); //var passcodeCharElements = _browserBot.WebDriver // .FindElement(By.ClassName("letter-select")) // .FindElements(By.TagName("strong")); //var passcodeChar1 = _credentials.Passcode[passcodeCharElements[0].Text.AsInteger() - 1].ToString(); //var passcodeChar2 = _credentials.Passcode[passcodeCharElements[1].Text.AsInteger() - 1].ToString(); //_browserBot.WebDriver.FindElement(By.Id("nameOne")).SendKeys(passcodeChar1); //_browserBot.WebDriver.FindElement(By.Id("nameTwo")).SendKeys(passcodeChar1); //_browserBot.WebDriver.FindElement(By.Id("log-in-to-online-banking2")).Click(); var scriptData = new Dictionary <string, string> { { "surname", _credentials.Surname }, { "cardNumber", _credentials.CardNumber }, { "sortCode", _credentials.SortCode }, { "membershipNumber", _credentials.MembershipNumber }, { "accountNumber", _credentials.AccountNumber } }; scriptManager.Execute("barclays-login.js", scriptData, ScriptBundles.ProviderLogin); }