/// <summary> /// Navigates to the main page of the learner application, if that page is not already navigated to. Chooses a /// user-defined EPA, then opens the Request Observation window , then chooses a user-specified observer and template, then /// clicks the Request button and then the Ok button /// </summary> /// <param name="tblElem">Any table element underneath the Program Learning Plan tab of the Learner role main page</param> /// <param name="groupItemToExpand">The exact text of the row to expand in the above table</param> /// <param name="linkTextToClick">The exact text of the EPA link to click on</param> /// <param name="observerName">The observer name as it appears on the Request Observation window</param> /// <param name="templateName">The learner name as it appears on the Request Observation window</param> /// <returns></returns> public LearnerRequestObsObject RequestObservationForEPA(string groupItemToExpand, string linkTextToClick, string observerName, string templateName) { LearnerRequestObsObject LRO = new LearnerRequestObsObject("", ""); // If we are not on the main page, then click Back to go there if (!Browser.Exists(Bys.CBDLearnerPage.AddReflectBtn, ElementCriteria.IsVisible)) { ClickAndWait(BackBtn); } // Choose the EPA ExpandTableAndClickLink(Bys.CBDLearnerPage.EPAIMTbl, groupItemToExpand, linkTextToClick); // If the above ExpandTableAndClickLink method failed to click the link, then lets click the link again if (!Browser.Exists(Bys.CBDLearnerPage.RequestObservationBtn, ElementCriteria.IsVisible)) { IWebElement table = Browser.FindElement(Bys.CBDLearnerPage.EPAIMTbl); IWebElement linkElem = table.FindElement(By.XPath(string.Format("//a[contains(text(),'{0}')]", linkTextToClick))); linkElem.Click(); // ToDo: Add more wait criteria for different conditions. Right now, this is only satisfying waiting after a user // clicks on an EPA in the EPA/IM table of Program Learning Plan table this.WaitUntil(TimeSpan.FromSeconds(60), Criteria.CBDLearnerPage.LoadElementDoneLoading); } // Open the Request Observation form ClickAndWait(RequestObservationBtn); // Fill out the form and return the values that were chosen LRO = SearchAndSelectObserverAndTemplateOnRequestObservationForm(observerName, templateName); ClickAndWait(RequestObsFormRequestBtn); ClickAndWait(RequestObsFormOkBtn); return(LRO); }
/// <summary> /// Opens the Request Observation window if it is not already open, then chooses a user-specified observer and template, then /// clicks the Request button and then the Ok button /// </summary> /// <param name="observerName"></param> /// <param name="templateName"></param> public LearnerRequestObsObject RequestObservation(string observerName, string templateName) { LearnerRequestObsObject LRO = new LearnerRequestObsObject("", ""); // If the form is not open, then open it. if (!Browser.Exists(Bys.CBDLearnerPage.RequestObsFormRequestBtn, ElementCriteria.IsVisible)) { ClickAndWait(RequestObservationBtn); } // Fill out the form and return the values that were chosen LRO = SearchAndSelectObserverAndTemplateOnRequestObservationForm(observerName, templateName); ClickAndWait(RequestObsFormRequestBtn); ClickAndWait(RequestObsFormOkBtn); return(LRO); }