/// <summary> /// Clicks the user-specified element and then waits for a window to close or open, or a page to load, /// depending on the element that was clicked /// </summary> /// <param name="buttonOrLinkElem">The element to click on</param> public void ClickToAdvance(IWebElement buttonOrLinkElem) { if (Browser.Exists(Bys.LoginPage.LoginBtn)) { if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id")) { LoginBtn.Click(); //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2")); return; } } 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."); } }
/// <summary> /// Clicks the user-specified element and then waits for a window to close or open, or a page to load, /// depending on the element that was clicked /// </summary> /// <param name="buttonOrLinkElem">The button element</param> public HomePage ClickAndWait(IWebElement buttonOrLinkElem) { if (Browser.Exists(Bys.LoginPage.LoginBtn)) { if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id")) { LoginBtn.Click(); //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2")); HomePage HP = new HomePage(Browser); return(HP); } } else { throw new Exception("No button or link was found with your passed parameter"); } return(null); }
/// <summary> /// Clicks the user-specified element and then waits for a window to close or open, or a page to load, /// depending on the element that was clicked /// </summary> /// <param name="buttonOrLinkElem">The element to click on</param> public HomePage ClickToAdvance(IWebElement buttonOrLinkElem) { if (Browser.Exists(Bys.LoginPage.LoginBtn)) { if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id")) { LoginBtn.Click(); HomePage HP = new HomePage(Browser); return(HP); } } 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> /// 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 buttonOrLinkElem) { if (Browser.Exists(Bys.LoginPage.LoginBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == LoginBtn.GetAttribute("outerHTML")) { LoginBtn.Click(); // Browser.WaitForElement(Bys.EducationCenterPage.MyCoursesTtl, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled); //Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsEnabled); new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("Courses.aspx")); return(new EducationCenterPage(Browser)); } 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> /// 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 bool ClickToAdvance(IWebElement buttonOrLinkElem) { bool buttonClicked = false; if (Browser.Exists(Bys.LoginPage.LoginBtn)) { if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id")) { LoginBtn.Click(); //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2")); buttonClicked = true; return(buttonClicked); } } else { throw new Exception("No button or link was found with your passed parameter"); } return(buttonClicked); }