/// <summary> /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load, /// depending on the button that was clicked /// </summary> /// <param name="buttonOrLinkElem">The element to click on</param> public dynamic ClickToAdvance(IWebElement buttonorElem) { if (Browser.Exists(Bys.AssignConfirmationPage.EditConfirmBtn)) { if (buttonorElem.GetAttribute("outerHTML") == EditConfirmBtn.GetAttribute("outerHTML")) { Thread.Sleep(0500); EditConfirmBtn.Click(); //Browser.WaitForElement(Bys.ProgramsPage.ProgramMngTbl, TimeSpan.FromSeconds(120), ElementCriteria.IsEnabled, ElementCriteria.IsVisible); //new WebDriverWait(Browser, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.UrlContains("programs")); ProgramsPage PP = new ProgramsPage(Browser); PP.WaitForInitialize(); return(PP); } } if (Browser.Exists(Bys.AssignConfirmationPage.ConfirmBtn)) { if (buttonorElem.GetAttribute("outerHTML") == ConfirmBtn.GetAttribute("outerHTML")) { Thread.Sleep(0500); ConfirmBtn.Click(); //Browser.WaitForElement(Bys.ProgramsPage.ProgramMngTbl, TimeSpan.FromSeconds(120), ElementCriteria.IsEnabled, ElementCriteria.IsVisible); //new WebDriverWait(Browser, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.UrlContains("programs")); ProgramsPage PP = new ProgramsPage(Browser); PP.WaitForInitialize(); return(PP); } } else { throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button."); } return(null); }
//private static IWebElement CancelBtn = Driver.FindElement(By.Id("dialogCancel")); #endregion internal void TerminateEmployment(string reason, string date, string note = null) { _logger.Info("Entering TerminateEmployment()"); // Fill out dialog Reason.SendKeys(reason); Date.Clear(); Date.SendKeys(date + Keys.Tab); Note.SendKeys(note); // Confirm the termination ConfirmBtn.Click(); _logger.Info("Exiting TerminateEmployment()"); }