/// <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); }
/// <summary> /// this specific method adding courses to curriculum for specific program /// </summary> /// <param name="browser"></param> public static void AddCourseToCurriculum(IWebDriver browser) { ProgramsPage PP = new ProgramsPage(browser); CurriculumCoursePage CoursePage = PP.EditProgramm(); CoursePage.AddOrRemoveCourses(CoursePage.AvailableCoursesTbl, CoursePage.AddSelectedBtn, 2, 3); PGYAssignmentPage Pgy = CoursePage.ClickToAdvance(CoursePage.NextBtn); Pgy.Grid_ClickElementWithoutTextInsideRow(Pgy.EditCoursePgyTbl, 2, 3); Pgy.Grid_ClickElementWithoutTextInsideRow(Pgy.EditCoursePgyTbl, 3, 3); AssignSummaryPage Summary = Pgy.ClickToAdvance(Pgy.NextBtn); AssignConfirmationPage Confirm = Summary.ClickToAdvance(Summary.NextBtn); Confirm.ClickToAdvance(Confirm.EditConfirmBtn); PP.Search("Anesthesiology"); }