/// <summary> /// To speed up test execution by not having to wait /// for the web driver to timeout, when the page text /// is not displayed, do (3)-page text checks /// Check if("PROGRAM AND ORGANIZATION SELECTION" = displayed) /// of if (Please select one of the available programs = displayed) /// or if (PROVIDER SEARCH PAGE = displayed) /// ///Use implicit wait and initialize the timeout. When a quick response is required ///1. Reinitialize the wait timeout = 0-secs, ///2. Wait for the page control operation to complete ///3. Reinitialize the wait timeout back = original timeout // /// </summary> /// <param name="seconds"></param> /// <returns></returns> public bool IsProgramSelectionDisplayed(int timeout) { bool IsProgramSelection = false; bool IsAvailableProgramSelection = false; bool IsSearchPage = false; Libary.SetWebDiverWaitTime(0); var controlWaitTime = timeout; while (controlWaitTime > 0) { //Search for PROGRAM AND ORGANIZATION SELECTION Page IsProgramSelection = this.IsProgramOrganizationSelectionDisplayed(); IsAvailableProgramSelection = this.IsAvailableProgramSelectionDisplayed(); //Search for PROVIDER SEARCH PAGE IsSearchPage = TestRunnerInterface.Map.providerSearchPage.IsSeachPageDisplayed(); if ((IsProgramSelection) || IsAvailableProgramSelection || (IsSearchPage)) { break; } else { System.Threading.Thread.Sleep(1 * 1000); //Wait 1-sec controlWaitTime--; continue; } } Libary.ReSetWebDiverWaitTime(); return(IsProgramSelection); }
/// <summary> /// Check if(Safe Home Page "Change Name" = displayed) /// or if (Chnage Pasword Text = displayed) /// ///Use implicit wait and initialize the timeout. When a quick response is required ///1. Reinitialize the wait timeout = 0-secs, ///2. Wait for the page control operation to complete ///3. Reinitialize the wait timeout back = original timeout // /// </summary> /// <param name="seconds"></param> /// <returns></returns> public bool IsChangePasswordDisplayed(int repeat_time) { bool IsFound = false; bool IsChangePwd = false; bool IsSafeHomePage = false; Libary.SetWebDiverWaitTime(0); var controlWaitTime = repeat_time; while (controlWaitTime > 0) { //Search for Change Password IsChangePwd = this.IsChangePasswordDisplayed(); //Search for SafeHomePage IsSafeHomePage = this.IsSafeHomePageDisplayed(); if ((IsChangePwd) || (IsSafeHomePage)) { IsFound = true; break; } else { System.Threading.Thread.Sleep(1000); //Wait 1-sec controlWaitTime--; continue; } } //Check if(Page displayed <= controlWaitTime) if (controlWaitTime <= 0) { IsFound = false; } Libary.ReSetWebDiverWaitTime(); return((IsFound) ? IsChangePwd : false); }
public bool IsMultipleOrganizationsDisplayed() { bool isFound = false; try { Libary.SetWebDiverWaitTime(0); IWebDriver browser = TestRunnerInterface.Map.safePage.browser; var pageText = browser.FindElement(By.TagName("body")).Text; if (pageText.IndexOf("You are currently associated with more than one organization", StringComparison.OrdinalIgnoreCase) > 0) { isFound = true; } } catch { isFound = false; } Libary.ReSetWebDiverWaitTime(); return(isFound); }
public bool IsAvailableProgramSelectionDisplayed() { bool isFound = false; try { Libary.SetWebDiverWaitTime(0); IWebDriver browser = TestRunnerInterface.Map.safePage.browser; var pageText = browser.FindElement(By.TagName("body")).Text; if (pageText.IndexOf("Please select one of the available programs", StringComparison.OrdinalIgnoreCase) > 0) { isFound = true; } } catch { isFound = false; } Libary.ReSetWebDiverWaitTime(); return(isFound); }
/// <summary> /// Check which Sign Out button text is displayed /// Text = Sign Out or Text = [Sign Out] /// /// </summary> public void SignOut() { //browser.FindElement(By.LinkText("[Sign Out]")).Click(); //Set Driver wait time = 0 Libary.SetWebDiverWaitTime(0); IWebElement signOut1 = null; IWebElement signOut2 = null; IWebElement signOut3 = null; try { //Signout for program = FSL signOut1 = browser.FindElement(By.Id("ctl00_SafeAccountLink")); } catch { //Empty catch } try { //Signout for SAFE Home page signOut2 = browser.FindElement(By.LinkText("[Sign Out]")); } catch { //Empty catch } try { //Signout for product application page signOut3 = browser.FindElement(By.LinkText("Sign Out")); } catch { //Empty catch } if ((signOut1 == null) && (signOut2 == null) && (signOut3 == null)) { throw new Exception("SignOut Link Not Found"); } // //Workaround for the Google browser run-Time Exception //Result Message: System.InvalidOperationException : unknown error: Element is not clickable at point (982, 12). //Other element would receive the click: <div class="ui-widget-overlay ui-front"></div> //Googled the error for fix // Actions actions = new Actions(browser); if (signOut1 != null) { //signOut1.Click(); actions.MoveToElement(signOut1).Click().Perform(); } if (signOut2 != null) { //signOut2.Click(); actions.MoveToElement(signOut2).Click().Perform(); } if (signOut3 != null) { //signOut3.Click(); actions.MoveToElement(signOut3).Click().Perform(); } //Reset Driver Wait Time Libary.ReSetWebDiverWaitTime(); }