/// <summary> /// Manage the basic commands to run the login. /// </summary> static void LoginAutomated() { try { WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(10)); for (int i = 0; i < loginControlIds.Length; i++) { string control = loginControlIds[i]; string value = loginControlValues[i]; IWebElement element = wait.ValidateControl(control); if (!string.IsNullOrEmpty(value)) { element.SendKeys(value); } else { element.Click(); } } } catch (Exception ex) { Console.WriteLine($"Error Trying to login: {ex.Message}"); } }
static void UploadLanesTemplate() { try { WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(10)); IWebElement element = wait.ValidateControl("uploadBtn"); element.Click(); Thread.Sleep(1000); AutoItX3 autoIt = new AutoItX3(); autoIt.ControlFocus("Open", "", "Edit1"); Thread.Sleep(1000); autoIt.ControlSetText("Open", "", "Edit1", requestTemplatePath + fileName); Thread.Sleep(1000); autoIt.ControlClick("Open", "", "Button1"); } catch (Exception ex) { throw ex; } }