Ejemplo n.º 1
0
        /// <summary>
        /// Uploads a file for every row that exists within the Evidence for Achievement of Milestone table
        /// </summary>
        private void UploadFileForAllEvidenceRows()
        {
            // Get the count of rows in the evidence table, then loop through them to add evidence to each one
            int countOfEvidenceRows = EvidenceTblRows.Count;

            for (int j = 0; j < countOfEvidenceRows; j++)
            {
                // If no file has been added yet for a row. We are checking this by seeing if findelements returns zero for an X link element
                // If a file is uploaded, this X link appears on the row
                if (EvidenceTblRows[j].FindElements(By.XPath("./descendant::a[@ng-show='canMarkComplete']")).Count == 0)
                {
                    // We have to find the Update link here, because if we find it outside of the for loop, we get a stale element exception
                    // for some reason
                    IWebElement evidenceUpdateLnk = EvidenceTblRows[j].FindElement(By.XPath("./descendant::a[text()='Update']"));
                    ElemSet.ScrollToElement(Browser, evidenceUpdateLnk);
                    evidenceUpdateLnk.Click();
                    this.WaitUntilAll(Criteria.PERTraineePage.EvidForAchieveFormDoneBtnEnabled);
                    Thread.Sleep(0700); // Need a little sleep here before upload

                    FileUtils.UploadFileUsingSendKeys(Browser, EvidForAchieveFormBrowseHiddenBtn, Bys.PERTraineePage.EvidForAchieveFormBrowseHiddenBtn, "C:\\SeleniumAutoIt\\test.txt");
                    this.WaitUntilAll(Criteria.PERTraineePage.EvidForAchieveFormFileRowEnabledAndVisible);

                    ElemSet.ScrollToElement(Browser, EvidForAchieveFormCloseLnk);
                    ClickAndWait(EvidForAchieveFormCloseLnk);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dropDownElem"> This is the dropdown element to click</param>
        /// <param name="textOfItem">The exact text of the item. If the item is located in a <b> tag, only send the bolded text of the item</b></param>
        public void SelectItemInCustomDropDown(IWebElement dropDownElem, string textOfItem)
        {
            IWebElement itemToSelectInDropdown = null;


            ElemSet.ScrollToElement(Browser, dropDownElem);

            dropDownElem.Click();
            Thread.Sleep(1500);
            string xpathStringForSpanTag = string.Format("//span[text()='{0}']", textOfItem);
            string xpathStringForBTag    = string.Format("//b[text()='{0}']", textOfItem);

            if (Browser.FindElements(By.XPath(xpathStringForSpanTag)).Count > 0)
            {
                itemToSelectInDropdown = Browser.FindElement(By.XPath(xpathStringForSpanTag));
            }
            else if (Browser.FindElements(By.XPath(xpathStringForBTag)).Count > 0)
            {
                itemToSelectInDropdown = Browser.FindElement(By.XPath(xpathStringForBTag));
            }



            itemToSelectInDropdown.Click();
        }
 /// <summary>
 /// Clicks on the user-specified milestone link in the table from the trainee dashboard page and waits for that page to appear
 /// </summary>
 /// <param name="milestoneName">The trainee's first and last name</param>
 public void GoToSpecificMilestone(string milestoneName)
 {
     ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
     ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, MilestonesTbl, Bys.DiplomaAssessorPage.MilestonesTblFirstRow, milestoneName, null, milestoneName);
     this.WaitUntil(Criteria.DiplomaAssessorPage.MainFrameVisibleAndEnabled);
     Browser.SwitchTo().Frame(MainFrame);
     this.WaitUntil(Criteria.DiplomaAssessorPage.MarkAsAchievedBtnVisible);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Clicks on the user-specified milestone link in the table from the trainee dashboard page and waits for that page to appear
 /// </summary>
 /// <param name="milestoneName">The trainee's first and last name</param>
 public void GoToSpecificMilestone(string milestoneName)
 {
     ElemSet.ScrollToElement(Browser, Browser.FindElements(Bys.DiplomaTraineePage.MilestonesInMilestonesTblLnks)[0]);
     ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, Browser.FindElement(Bys.DiplomaTraineePage.MilestonesTbl),
                                             Bys.DiplomaTraineePage.MilestonesTblFirstRow, milestoneName, "a", milestoneName, "a");
     this.WaitUntil(Criteria.DiplomaDirectorPage.MainFrameVisibleAndEnabled);
     Browser.SwitchTo().Frame(MainFrame);
     this.WaitUntil(Criteria.DiplomaDirectorPage.MarkAsAchievedBtnVisible);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Clicks the logout link, waits for the Royal College client site to appear, navigates to the backdoor login,
        /// then returns the backdoor login page
        /// </summary>
        /// <returns></returns>
        public LoginPage Logout()
        {
            Browser.SwitchTo().DefaultContent();
            ElemSet.ScrollToElement(Browser, LogoutLnk);
            LogoutLnk.Click();
            new WebDriverWait(Browser, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.UrlContains("login"));
            LoginPage LP = Navigation.GoToLoginPage(Browser);

            return(LP);
        }
        /// <summary>
        /// Fills the required fields on the AMA Self Learning Page
        /// </summary>
        ///
        public void FillOutAMAActivityForm1(int creditValue)
        {
            //generate the data to fill out the data
            DateTime dt            = DateTime.Now;
            int      currentDay    = dt.Day;
            int      currentMonth  = dt.Month;
            int      currentYear   = dt.Year;
            int      currentHour   = dt.Hour;
            int      currentMinute = dt.Minute;
            int      currentSecond = dt.Second;

            //create a string for the program title
            String ProgramTitle = "TestRun_" + currentMonth + "_" + currentDay + "_" + currentYear + "-" + currentHour + ":" + currentMinute + ":" + currentSecond;


            //These lines fill out the
            //text fields in the AMA Self Learning Activity Form

            ProgramTitleAMASLTxt.SendKeys(ProgramTitle);
            ProvinceSelectorAMASLDrpDn.SelectByIndex(1);
            ProvinceSelectorAMASLDrpDn.SelectByText("Alberta (AB)");
            CityAMASLTxt.SendKeys("Test City");
            PlanningOrganizationAMASLTxt.SendKeys("Test");
            string date = DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);  //Generate a date to use later in the form

            ElemSet.ScrollToElement(Browser, ActivityStartDateAMASLTxt);
            ActivityStartDateAMASLTxt.SendKeys(date);
            ActivityCompletionDateAMASLTxt.SendKeys(date);
            CreditsClaimedAMASLTxt.SendKeys("" + creditValue);



            //clicking on the radio buttons
            //at the end of the form
            ElemSet.ClickAfterScroll(Browser, ChangedImprovedAMASLRdo);
            ElemSet.ClickAfterScroll(Browser, LearnedNewAMASLRdo);
            ElemSet.ClickAfterScroll(Browser, LearnedMoreAMASLRdo);
            ElemSet.ClickAfterScroll(Browser, DissatisfiedAMASLRdo);
            ElemSet.ClickAfterScroll(Browser, BiasedAMASLRdo);
            ElemSet.ClickAfterScroll(Browser, ConfirmedAMASLRdo);

            // For some reason, whenever we use Selenium's built in click method here, it triggers the application to add more than
            // 1 credit for the activity/user (We entered "1" into the CreditsClaimed text box above, so only 1 credit should get
            // added for the user). I added a workaround to use the javascript version of a click, and this
            // works (only adds the specified amount of credits) For more info,
            // see https://stackoverflow.com/questions/24571048/selenium-webelement-click-vs-javascript-click-event
            JavascriptUtils.Click(Browser, SubmitButton);
            SubmitButton.SendKeys(Keys.Tab);

            Thread.Sleep(20000);     // MIKE: Definitely add wait criteria here. I see that a popup appears, we can wait on an element in this popup
        }
        /// <summary>
        /// Fills the required fields on the AMA Group Learning Page
        /// </summary>
        ///
        public void FillOutAMAActivityForm2()
        {
            //generate the data to fill out the data
            DateTime dt            = DateTime.Now;
            int      currentDay    = dt.Day;
            int      currentMonth  = dt.Month;
            int      currentYear   = dt.Year;
            int      currentHour   = dt.Hour;
            int      currentMinute = dt.Minute;
            int      currentSecond = dt.Second;

            //create a string for the program title
            String ProgramTitle = "TestRun_" + currentMonth + "_" + currentDay + "_" + currentYear + "-" + currentHour + ":" + currentMinute + ":" + currentSecond;


            //These lines fill out the
            //text fields in the AMA Group Learning Activity Form

            ProgramTitleAMAGLTxt.SendKeys(ProgramTitle);
            ProvinceSelectorAMAGLDrpDn.SelectByIndex(1);
            ProvinceSelectorAMAGLDrpDn.SelectByText("Alberta (AB)");
            CityAMAGLTxt.SendKeys("Test City");
            PlanningOrganizationAMAGLTxt.SendKeys("Test");
            string date = DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);  //generate a date value for the activity forms

            ElemSet.ScrollToElement(Browser, ActivityStartDateAMAGLTxt);
            ActivityStartDateAMAGLTxt.SendKeys(date);
            ActivityCompletionDateAMAGLTxt.SendKeys(date);
            CreditsClaimedAMAGLTxt.SendKeys("1");

            //Select out the group radio buttons
            ElemSet.ClickAfterScroll(Browser, ChangedImprovedAMAGLRdo);
            ElemSet.ClickAfterScroll(Browser, LearnedNewAMAGLRdo);
            ElemSet.ClickAfterScroll(Browser, LearnedMoreAMAGLRdo);
            ElemSet.ClickAfterScroll(Browser, DissatisfiedAMAGLRdo);
            ElemSet.ClickAfterScroll(Browser, BiasedAMAGLRdo);
            ElemSet.ClickAfterScroll(Browser, ConfirmedAMAGLRdo);



            // MIKE: I would name these elements with a little more detail. It took me, a new person, a little bit of time to figure out what radio button was for each variable
            // MIKE: Always start with the beginning text when naming elements. For example for this radio button, name it "ThisExperienceConfirmedRdo" instead of just "Confirmed"

            // For some reason, whenever we use Selenium's built in click method here, it triggers the application to add more than
            // 1 credit for the activity/user (We entered "1" into the CreditsClaimed text box above, so only 1 credit should get
            // added for the user). I added a workaround to use the javascript version of a click, and this
            // works (only adds the specified amount of credits) For more info,
            // see https://stackoverflow.com/questions/24571048/selenium-webelement-click-vs-javascript-click-event
            JavascriptUtils.Click(Browser, SubmitButton);
            SubmitButton.SendKeys(Keys.Tab);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Clicks the logout link, waits for the Royal College client site to appear, navigates to the backdoor login,
        /// then returns the backdoor login page
        /// </summary>
        /// <returns></returns>
        public LoginPage Logout()
        {
            Browser.SwitchTo().DefaultContent();
            ElemSet.ScrollToElement(Browser, LogoutLnk);
            LogoutLnk.Click();
            Thread.Sleep(1000);
            //The following didnt work on the Azure site, as it redirected to royal college after logout. So right now, I am adding a
            // wait to wait for the Login link. Monitor going forward
            //new WebDriverWait(Browser, TimeSpan.FromSeconds(60)).Until(ExpectedConditions.UrlContains("login"));
            this.WaitForElement(Bys.RCPPage.LoginLnk, ElementCriteria.IsVisible);
            LoginPage LP = Navigation.GoToLoginPage(Browser);

            return(LP);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Selects "Needs Additional Information" in the Status drop down, clicks on the user-specified milestone,
        /// enters user-specified text into the "Your Reply" text box, clicks Save, then goes back to the Dashboard
        /// </summary>
        /// <param name="milestoneName">The milestone name as it appears in the text of the HTML elementThe exact text of the milestone inside the milestone table</param>
        /// <param name="additionalInfoText">The text you want to enter for the requested or submitted additional infoThe text of your choice</param>
        public void SubmitAdditionalInfo(string milestoneName, string additionalInfoText)
        {
            this.WaitUntilAny(Criteria.PERTraineePage.MilestonesTblMilestoneNameLinksEnabled);

            ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, MilestonesTbl, Bys.PERTraineePage.MilestonesTblFirstRow, milestoneName, "a", milestoneName, "a");
            this.WaitUntilAll(Criteria.PERTraineePage.EvidenceTblUpdateLinksEnabledAndVisible);

            YourReplyTxt.SendKeys(additionalInfoText);
            this.WaitUntilAll(Criteria.PERTraineePage.YourReplySaveChangesButtonVisible);

            ClickAndWait(YourReplySaveChangesBtn);

            ClickAndWait(ResubmitBtn);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Clicks the expansion icon of any row within a table underneath the lower tabs (Reflections, Narratives, etc.) of this page. It will
        /// then click on the link underneath that expansion.
        /// </summary>
        /// <param name="tblElemBy">The table element that contains the expansion/collapse icon. Send the By type of the table. <see cref="CBDLearnerPageBys"/></param>
        /// <param name="groupItemToExpand">The exact text of the row name with the the expansion icon</param>
        /// <param name="linkTextToClick">The exact text of the link you want to click on</param>
        /// ToDo: I still need to add logic to wait for a given criteria after the link is clicked.
        /// I may want to transfer this to <see cref="ElemSet"/> once I get familar with all of the roles, as it may be able to be used for all of them
        public void ExpandTableAndClickLink(By tblElemBy, string groupItemToExpand, string linkTextToClick)
        {
            // Expand the grouping row
            Grid_ExpandOrCollapseButton(tblElemBy, groupItemToExpand, "expand");

            // Get the link elem
            IWebElement table    = Browser.FindElement(tblElemBy);
            IWebElement linkElem = table.FindElement(By.XPath(string.Format("//a[contains(text(),'{0}')]", linkTextToClick)));

            ElemSet.ScrollToElement(Browser, linkElem);
            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(180), Criteria.CBDLearnerPage.LoadElementDoneLoading);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Selects "Needs Additional Information" in the Status drop down, clicks on the user-specified milestone,
        /// enters user-specified text into the "Your Reply" text box, clicks Save, then goes back to the Dashboard
        /// </summary>
        /// <param name="milestoneName">The milestone name as it appears in the text of the HTML elementThe exact text of the milestone inside the milestone table</param>
        /// <param name="additionalInfoText">The text you want to enter for the requested or submitted additional infoThe text of your choice</param>
        public void SubmitAdditionalInfo(string milestoneName, string additionalInfoText)
        {
            StatusSelElem.SelectByText("Needs Additional Information");

            this.WaitUntilAny(Criteria.DiplomaTraineePage.MilestonesTblMilestoneNameLinksEnabled);

            ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
            ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, MilestonesTbl, Bys.DiplomaTraineePage.MilestonesTblFirstRow, milestoneName, null, milestoneName);
            WaitForMilestoneFrame();

            YourReplyTxt.SendKeys(additionalInfoText);
            this.WaitUntilAll(Criteria.DiplomaTraineePage.YourReplySaveChangesButtonVisible);

            ClickAndWait(YourReplySaveChangesBtn);

            ClickAndWait(ResubmitBtn);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// This method scrool to the bottom of the page to load all courses.
        /// </summary>
        public void ScrolltoGetAllCourses()
        {
            int countofRowNoScroll;
            int countofRowFirstScroll;

            do
            {
                List <IWebElement> EnterRow = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowNoScroll = EnterRow.Count;
                //Thread.Sleep(1000);
                ElemSet.ScrollToElement(Browser, FaceBookLnk);

                Thread.Sleep(1000);
                List <IWebElement> EnterRowFirstScroll1 = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowFirstScroll = EnterRowFirstScroll1.Count;
                Thread.Sleep(1000);
            }while (countofRowFirstScroll > countofRowNoScroll);
        }
        public void CourseTracker_Resident_ElectiveCoursePass()
        {
            ///  1.Navigate to the login page login as a AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10021378", "password");

            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
            }

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep          = ED.ClickToAdvance(ED.GcepLnk);
            string   CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            string[] CourseyrackernotNull = CourseTracker.Split(' ');
            int      regCoursCount        = Convert.ToInt16(CourseyrackernotNull[3]);

            Gcep.ScrolltoGetAllCourses();

            string xPathVariable1 = string.Format("//div[@class='activity-info-name']/h4[.='{0}']/../../..//button", "Confidentiality");

            Thread.Sleep(0500);
            IWebElement button1 = browser.FindElement(By.XPath(xPathVariable1));

            ElemSet.ScrollToElement(browser, button1);

            // ElemSet.ScrollToElement(Browser, Browser.FindElement(By.LinkText("AMA TEST")));
            CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, "AUTOMATION_004");

            Gcep = Course.TestPass();
            Gcep.ScrolltoGetAllCourses();

            // Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, "AUTOMATION_003", "View Certificate"), "View Certificet button not visible");

            string CourseTrackerAfterTestCompletion = Gcep.ResidentCourseTrackerLbl.Text;

            string[] courseword3 = CourseTrackerAfterTestCompletion.Split(' ');
            int      CountOfCompletedRegCourseafterPassingTest = Convert.ToInt16(courseword3[3]);

            Assert.True(regCoursCount + 1 == (CountOfCompletedRegCourseafterPassingTest));
        }
        public void CourseTracker_Resident_ElectiveCourseFail()
        {
            ///  1.Navigate to the login page login as a AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10021378", "password");

            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
            }

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep          = ED.ClickToAdvance(ED.GcepLnk);
            string   CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            string[] CourseyrackernotNull = CourseTracker.Split(' ');
            int      regCoursCount        = Convert.ToInt16(CourseyrackernotNull[2]);
            int      countofRowNoScroll;
            int      countofRowFirstScroll;

            do
            {
                List <IWebElement> EnterRow = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowNoScroll = EnterRow.Count;
                //Thread.Sleep(1000);
                ElemSet.ScrollToElement(Browser, Gcep.FaceBookLnk);

                Thread.Sleep(1000);
                List <IWebElement> EnterRowFirstScroll1 = new List <IWebElement>(Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']")));
                countofRowFirstScroll = EnterRowFirstScroll1.Count;
                Thread.Sleep(1000);
            }while (countofRowFirstScroll > countofRowNoScroll);

            //Assert.True(Gcep.VerificationOfChoosenCoursesAssignedForResident(browser, CourseNames), "Course count are not equal");

            string xPathVariable1 = string.Format("//div[@class='activity-info-name']/h4[.='{0}']/../../..//button", "content-2jpg");

            Thread.Sleep(0500);
            IWebElement button1 = browser.FindElement(By.XPath(xPathVariable1));

            ElemSet.ScrollToElement(browser, button1);
        }
        /// <summary>
        /// Clicks the Review button for a user-specified Trainee, clicks on the milestone links in the Milestone table, then marks the milestone
        /// as Achieved or Not Achieved, depending on the AllAchieved parameter
        /// </summary>
        /// <param name="traineeFullName">The trainee's first and last nameFirst and last name of the trainee</param>
        /// <param name="AllAchieved">If true, then mark all milestones as achieved, else mark all but 1 milestone as achieved</param>
        public void MarkAllMilestones(string traineeFullName, bool AllAchieved)
        {
            GoToTraineeDashboard(traineeFullName);

            int    countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count;
            string currentMileStoneText        = "";

            // loop through every row on the milestone table
            for (int i = 1; i <= countOfRowsInMilestoneTable; i++)
            {
                currentMileStoneText = MilestonesInMilestonesTblLnks[0].Text;
                ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
                MilestonesInMilestonesTblLnks[0].Click();
                this.WaitUntil(Criteria.DiplomaAssessorPage.MainFrameVisibleAndEnabled);
                Browser.SwitchTo().Frame(MainFrame);
                this.WaitUntil(Criteria.DiplomaAssessorPage.MarkAsAchievedBtnVisible);

                if (AllAchieved == true) // Mark all milestones as achieved if set to true
                {
                    ClickAndWait(MarkAsAchievedBtn);
                    ClickAndWait(MarkAsAchievedFormSubmitBtn);
                }

                else // Mark all milestones except for one as achieved. Mark the last one as not achieved
                {
                    if (i < countOfRowsInMilestoneTable) // If we are not on the last row, mark as achieved. Else mark as not achieved
                    {
                        ClickAndWait(MarkAsAchievedBtn);
                        ClickAndWait(MarkAsAchievedFormSubmitBtn);
                    }
                    else
                    {
                        ClickAndWait(MarkAsNotAchievedBtn);
                        ClickAndWait(MarkAsNotAchievedFormSubmitBtn);
                    }
                }
            }
        }
        /// <summary>
        /// Clicks the Review button for a user-specified Trainee, selects Under Review in the Status select element,
        /// clicks on the milestone links in the Milestone table, then marks the milestone
        /// as Achieved or Not Achieved, depending on the AllAchieved parameter
        /// </summary>
        /// <param name="traineeFullName">The trainee's first and last nameFirst and last name of the trainee</param>
        /// <param name="AllAchieved">If true, then mark all milestones as achieved, else mark all but 1 milestone as achieved</param>
        public void MarkAllMilestones(string traineeFullName, bool AllAchieved)
        {
            GoToTraineeDashboard(traineeFullName);

            StatusSelElem.SelectByText("Under Review");

            int    countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count;
            string currentMileStoneText        = "";

            // loop through every row on the milestone table
            for (int i = 1; i <= countOfRowsInMilestoneTable; i++)
            {
                StatusSelElem.SelectByText("Under Review");

                currentMileStoneText = MilestonesInMilestonesTblLnks[0].Text;
                ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
                MilestonesInMilestonesTblLnks[0].Click();
                this.WaitUntilAll(Criteria.PERAssessorPage.MarkAsAchievedBtnVisible);

                if (AllAchieved == true) // Mark all milestones as achieved if set to true
                {
                    ClickAndWait(MarkAsAchievedBtn);
                }

                else // Mark all milestones except for one as achieved. Mark the last one as not achieved
                {
                    if (i < countOfRowsInMilestoneTable) // If we are not on the last row, mark as achieved. Else mark as not achieved
                    {
                        ClickAndWait(MarkAsAchievedBtn);
                    }
                    else
                    {
                        ClickAndWait(MarkAsNotAchievedBtn);
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public void Resident_GCEP_SortBy_Progress()
        {
            ///  1.Navigate to the login page login as
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10031193", "password");

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Clicking resident sort by progrees button.
            Gcep.ResidentGCEPSortBYProgressBtn.Click();
            Gcep.WaitForInitialize();

            ///  4.Clicking to Sort By duration button and wait to page reload.
            do
            {
                ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk);
            }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed);

            ///  5.Getting all progress information checking all conditions by AC#28

            Assert.True(Gcep.ResidentCourseProgressVerification(Gcep.ResidentCoutseStatusFailedLbl, Gcep.ResidentCourseStatusLockedLbl));
        }
Ejemplo n.º 18
0
        /// <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.AssignSummaryPage.NextBtn))
            {
                if (buttonorElem.GetAttribute("id") == NextBtn.GetAttribute("id"))
                {
                    Browser.WaitForElement(Bys.AssignSummaryPage.NextBtn, ElementCriteria.IsEnabled);
                    Thread.Sleep(0500);
                    ElemSet.ScrollToElement(Browser, NextBtn);
                    NextBtn.Click();
                    Browser.WaitForElement(Bys.AMAPage.BreadCrumbLnksContainer, TimeSpan.FromSeconds(90), ElementCriteria.IsEnabled, ElementCriteria.IsVisible);
                    AssignConfirmationPage ACP = new AssignConfirmationPage(Browser);
                    ACP.WaitForInitialize();
                    return(ACP);
                }
            }
            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>
        /// Fills out the Self page
        /// </summary>
        ///

        public void FillOutSelfLearningForm()
        {
            //generate the data to fill out the data

            DateTime dt            = DateTime.Now;
            int      currentDay    = dt.Day;
            int      currentMonth  = dt.Month;
            int      currentYear   = dt.Year;
            int      currentHour   = dt.Hour;
            int      currentMinute = dt.Minute;
            int      currentSecond = dt.Second;


            //create a string for the program title
            String ProgramTitle = "TestRun_" + currentMonth + "_" + currentDay + "_" + currentYear + "-" + currentHour + ":" + currentMinute + ":" + currentSecond;

            Thread.Sleep(3000);//add wait criteria later
            ElemSet.ScrollToElement(Browser, ProgramTitleCertifiedSelfLearningTxt);
            ProgramTitleCertifiedSelfLearningTxt.SendKeys(ProgramTitle);


            //move down to the province selection screen

            ElemSet.ScrollToElement(Browser, CityTxtCertifiedSelfLearningTxt);


            //select alberta
            ProvinceSelectorCertifiedSelfLearningDrpDn.SelectByIndex(1);
            //Fill out the test city
            CityTxtCertifiedSelfLearningTxt.SendKeys("Test City");
            //fill out the
            PlanningOrganizationCertifiedSelfLearningTxt.SendKeys("Test");

            //generate a date for these Activity Test
            DateTime dt2                = DateTime.Today.AddDays(-1);
            String   startDateText      = dt2.Month + "/" + dt2.Day + "/" + dt2.Year;
            String   completionDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year;


            ActivityStartDateCertifiedSelfLearningTxt.SendKeys(startDateText);
            ActivityCompletionDateCertifiedSelfLearningTxt.SendKeys(completionDateText);

            CreditsClaimedDateCertifiedSelfLearningTxt.SendKeys("1");



            ElemSet.ClickAfterScroll(Browser, ChangedImprovedCertifiedGSelfLearningRdo);
            ElemSet.ClickAfterScroll(Browser, LearnedNewCertifiedSelfLearningRdo);
            ElemSet.ClickAfterScroll(Browser, LearnedMoreCertifiedSelfLearningRdo);
            ElemSet.ClickAfterScroll(Browser, ConfirmedCertifiedSelfLearningRdo);
            ElemSet.ClickAfterScroll(Browser, BiasedCertifiedSelfLearningRdo);
            ElemSet.ClickAfterScroll(Browser, DissatisfiedCertifiedSelfLearningRdo);


            ElemSet.ScrollToElement(Browser, SubmitButton);

            // For some reason, whenever we use Selenium's built in click method here, it triggers the application to add more than
            // 1 credit for the activity/user (We entered "1" into the CreditsClaimed text box above, so only 1 credit should get
            // added for the user). I added a workaround to use the javascript version of a click, and this
            // works (only adds the specified amount of credits) For more info,
            // see https://stackoverflow.com/questions/24571048/selenium-webelement-click-vs-javascript-click-event
            JavascriptUtils.Click(Browser, SubmitButton);
            SubmitButton.SendKeys(Keys.Tab);

            Thread.Sleep(20000);
        }
Ejemplo n.º 20
0
        public void Resident_GCEP_SortBy_Duration()
        {
            ///  1.Navigate to the login page login as
            LoginPage           LP = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED = LP.LoginAsUser("10031194", "password");

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Waiting to course tracker dislay and gennting count of courses if there is not any course assigned assign courses
            Browser.WaitForElement(Bys.GCEPPage.ResidentCourseTrackerLbl, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible);
            string CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            ///  4.Clicking to Sort By duration button and wait to page reload.
            Gcep.ResidentGCEPSortBYDurationBtn.Click();
            Gcep.WaitForInitialize();

            if (CourseTracker.Contains("0"))
            {
                Gcep.ClickToAdvance(Gcep.SignOutLnk);
                LP   = Navigation.GoToLoginPage(browser);
                ED   = LP.LoginAsUser("10031315", "password");
                Gcep = ED.ClickToAdvance(ED.GcepLnk);
                ///  3.from Gcep navigating to institution managment searching for institution looking for curriculum and if their any curriculum with the same name deleting and starting create new curriculum.
                InstitutionsPage     Instute = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk);
                InstitutionsGCEPPage InsGcep = Instute.SearchforInstitutions("");

                ProgramsPage Program = InsGcep.ClickToAdvance(InsGcep.InstitutionProgramManagmentLnk);
                Program.UnassignCurriculum();

                CurriculumMngPage Curriculum = InsGcep.ClickToAdvance(InsGcep.InstitutionCurriculumTmpLnk);
                Curriculum.Search("");
                Curriculum.DeleteCurriculum("");
                CurriculumCoursePage CurCoursPage = Curriculum.ClickToAdvance(Curriculum.CreateCurriculumTemplateBtn);

                ///  4.Form course page choosing available courses from table by index
                CurCoursPage.AddOrRemoveCourses(CurCoursPage.AvailableCoursesTbl, CurCoursPage.AddSelectedBtn, 1, 8, 9);

                // List<string> CourseNames = new List<string>();
                List <string> CourseNames = CurCoursPage.GetTheNamesChoosenCourses();

                ///  5. Giving the name for curriculum passing parameter from TestCase as a string
                CurCoursPage.CurriculumNameTxt.Clear();
                CurCoursPage.CurriculumNameTxt.SendKeys("");

                ///  6.Saving curriculum and navigating to the pgy pages to assigne course to students
                PGYAssignmentPage PGY = CurCoursPage.ClickToAdvance(CurCoursPage.NextBtn);

                ///  7.Choosing student years to assign course by index for each course
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 1, 5);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 2, 5);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 3, 5);

                ///  8. Saving curriculum and navigating to curriculum management page again
                PGY.ClickToAdvance(PGY.SaveExitBtn);

                /// 9.Finding curriculum what we create and assigning to the programm
                Curriculum.Search("");
                Curriculum.Actioncell.Click();
                AssignProgramPage Assign = Curriculum.ClickToAdvance(Curriculum.AssignToProgrammLnk);

                ///  10.Choosing starting date and ending date for  program  and clicking next button
                string StartingDate = Assign.ChoosingStartDate();
                string EndingDate   = Assign.ChoosingEndDate(1, "MM/d/yyyy");
                Assign.AssignProgramm();
                AssignSummaryPage Summary = Assign.ClickToAdvance(Assign.NextBtn);

                ///  11.Verifying from Assign Summary page program is displayed
                Assert.IsTrue(Summary.CreatedProgramName.Displayed);
                Assert.AreEqual((Summary.CreatedProgramName.Text), "");

                ///  12.Verifying Assing confirmation test page curriculum name and starting date and ending dates are there which we choose.
                AssignConfirmationPage Confirmation = Summary.ClickToAdvance(Summary.NextBtn);
                // Assert.IsTrue(Confirmation.Grid_CellTextFound(Confirmation.ProgramSummaryTbl, StartingDate + " - " + EndingDate));
                Thread.Sleep(0500);
                Confirmation.ConfirmBtn.Click();
                ///  13.Signing out and Signing in as a Resindent counting required courses from myRequiredCourses
                Curriculum.ClickToAdvance(Curriculum.SignOutLnk);
                LP   = Navigation.GoToLoginPage(browser);
                ED   = LP.LoginAsUser("10021377", "password"); //10021375,10021377,21387
                Gcep = ED.ClickToAdvance(ED.GcepLnk);          //31224
            }

            ///  5.Scrolling down to get all informartion about courses and verify that exploer elective course link displayed.
            do
            {
                ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk); Thread.Sleep(1000);
            }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed); //while (j< countofCourse);
            Assert.True(Gcep.ResidentGcepShowElectiveCourseLnk.Displayed);

            ///  6.Getting all duration for courses and verifying its in ascending order
            Assert.True(Gcep.ResidentCourseCompareDuration());
        }
Ejemplo n.º 21
0
        public void Resident_CompletedCourse_Listing_AcedemicYear()
        {
            int countOfMatchingCoursesFor2018_2019 = 0;
            int countOfMatchingCoursesFor2017_2018 = 0;
            int countOfMatchingCoursesFor2016_2017 = 0;

            ///  1.Navigate to the login page login as
            LoginPage           LP = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED = LP.LoginAsUser("10031194", "password");//30248

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Waiting to course tracker dislay and getting count of courses if there is not any course assigned assign courses
            Gcep.ResidentGCEPCompletedSwitchBtn.Click();

            Browser.WaitForElement(Bys.GCEPPage.ResidentGCEPAcedimicYearSelElem, TimeSpan.FromSeconds(90), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
            Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);

            if (!Gcep.ResidentGCEPTranscriptBtn.GetAttribute("class").Contains("disabled"))
            {
                ///  4.Verifying transcript and certificate buttons are displayed and due date,progress and duration buttons are disabled..
                Assert.IsTrue(Gcep.ResidentGCEPTranscriptBtn.Displayed);
                Assert.IsTrue(Gcep.ResidentGCEPCertificatesDownloadBtn.Displayed);
                Assert.AreEqual("disabled", Gcep.ResidentGCEPSortBYDueDateBtn.GetAttribute("class"));
                Assert.AreEqual("disabled", Gcep.ResidentGCEPSortBYDurationBtn.GetAttribute("class"));
                Assert.AreEqual("disabled", Gcep.ResidentGCEPSortBYProgressBtn.GetAttribute("class"));

                ///  5. Scrolling down to get all information about completed courses.
                Gcep.ScrolltoGetAllCourses();

                ///  6.
                List <string> courseCompletionYears = new List <string>();
                List <string> CompletionDateTextRaw = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-xs-12 col-md-2 activity-status-action']/button/../span[@class='completed-date ng-binding']")).Select(iw => iw.Text));
                for (int i = 0; i < CompletionDateTextRaw.Count; i++)
                {
                    courseCompletionYears.Add(CompletionDateTextRaw[i].Remove(0, 11));
                }


                List <string> selectValueAcedemicYearDropdown        = new List <string>(Browser.FindElements(Bys.GCEPPage.ResidentGCEPAcedimicYearSelElem).Select(IWebElement => IWebElement.Text));
                string        selectValueAcedemicYearDropdownTextRaw = selectValueAcedemicYearDropdown[0].ToString();
                string[]      selectedAcademicYear = null;
                if (BrowserName == BrowserNames.InternetExplorer)
                {
                    selectedAcademicYear = new string[] { "2018-2019", "2017-2018", "2016-2017" };
                }
                else
                {
                    string[] separatingChars = { "All Academic Years\r\n", " ", "\r\n" };
                    selectedAcademicYear = selectValueAcedemicYearDropdownTextRaw.Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries);
                }
                if ("2018-2019" == selectedAcademicYear[0])
                {
                    for (int k = 0; k < courseCompletionYears.Count; k++)
                    {
                        if (Convert.ToDateTime("07 / 01 / 2018") <= Convert.ToDateTime(courseCompletionYears[k]) & Convert.ToDateTime(courseCompletionYears[k]) <= Convert.ToDateTime("06 / 30 / 2019"))
                        {
                            countOfMatchingCoursesFor2018_2019++;
                        }
                    }
                }
                if ("2017-2018" == selectedAcademicYear[1])
                {
                    for (int l = 0; l < courseCompletionYears.Count; l++)
                    {
                        if (Convert.ToDateTime("07 / 01 / 2017") <= Convert.ToDateTime(courseCompletionYears[l]) & Convert.ToDateTime(courseCompletionYears[l]) <= Convert.ToDateTime("06 / 30 / 2018"))
                        {
                            countOfMatchingCoursesFor2017_2018++;
                        }
                    }
                }
                if ("2016-2017" == selectedAcademicYear[2])
                {
                    for (int n = 0; n < courseCompletionYears.Count; n++)
                    {
                        if (Convert.ToDateTime("07 / 01 / 2016") <= Convert.ToDateTime(courseCompletionYears[n]) & Convert.ToDateTime(courseCompletionYears[n]) <= Convert.ToDateTime("06 / 30 / 2017"))
                        {
                            countOfMatchingCoursesFor2016_2017++;
                        }
                    }
                }

                Gcep.ResidentGCEPAcedimicYearSelElem.SelectByIndex(1);
                Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                ElemSet.ScrollToElement(Browser, Gcep.FaceBookLnk);

                if (countOfMatchingCoursesFor2018_2019 == 0)
                {
                    Assert.True(Gcep.ResidentNoCourseBeenCompltetLbl.Displayed);
                }
                else
                {
                    IList <IWebElement> CourseRows = Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']"));
                    int countOfCoursesFirstIndex   = CourseRows.Count;
                    Assert.True(countOfMatchingCoursesFor2018_2019 == countOfCoursesFirstIndex);
                }


                Gcep.ResidentGCEPAcedimicYearSelElem.SelectByIndex(2);
                Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                Gcep.ScrolltoGetAllCourses();


                if (countOfMatchingCoursesFor2017_2018 == 0)
                {
                    Assert.True(Gcep.ResidentNoCourseBeenCompltetLbl.Displayed);
                }
                else
                {
                    IList <IWebElement> CourseRows = Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']"));
                    int countOfCoursesSecondIndex  = CourseRows.Count;
                    Assert.True(countOfMatchingCoursesFor2017_2018 == countOfCoursesSecondIndex);
                }

                Gcep.ResidentGCEPAcedimicYearSelElem.SelectByIndex(3);
                Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                Gcep.ScrolltoGetAllCourses();

                if (countOfMatchingCoursesFor2016_2017 == 0)
                {
                    Assert.True(Gcep.ResidentNoCourseBeenCompltetLbl.Displayed);
                }
                else
                {
                    IList <IWebElement> CourseRows = Browser.FindElements(By.XPath("//div[@class='activity-listing-bottom ng-scope']"));
                    int countOfCoursesThirdIndex   = CourseRows.Count;
                    Assert.True(countOfMatchingCoursesFor2016_2017 == countOfCoursesThirdIndex);
                }
            }
        }
Ejemplo n.º 22
0
        public void Resident_CourseListing_StartNow()
        {
            ///  1.Navigate to the login page login as
            LoginPage           LP = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED = LP.LoginAsUser("10030248", "password");//30248

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);

            ///  3. Waiting to course tracker to display and verifying all sort by buttons are displayed and enabled
            Browser.WaitForElement(Bys.GCEPPage.ResidentCourseTrackerLbl, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible);
            Assert.True(Gcep.ResidentGCEPSortBYDueDateBtn.Displayed);
            Assert.True(Gcep.ResidentGCEPSortBYDurationBtn.Displayed);
            Assert.True(Gcep.ResidentGCEPSortBYProgressBtn.Displayed);


            ///  4.If Start Now button disabled then scrol down and click show elective courses
            if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled"))
            {
                Gcep.ScrolltoGetAllCourses();
                Gcep.ResidentGcepShowElectiveCourseLnk.Click();
            }

            ///  5.Scrolling down and saving all courses headers.
            Gcep.ScrolltoGetAllCourses();
            List <string> courseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text));


            ///  6.Getting locked courses headers and comparing with all courses headers by due date if its matching removing locked courses headers
            List <string> lockedCourseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (lockedCourseTitlesByDueDate.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDueDate.Count; i++)
                {
                    for (int j = 0; j < lockedCourseTitlesByDueDate.Count; j++)
                    {
                        if (courseTitlesByDueDate[i] == lockedCourseTitlesByDueDate[j])
                        {
                            courseTitlesByDueDate.Remove(courseTitlesByDueDate[i]);
                        }
                    }
                }
            }

            ///  7.Getting completed courses headers and comparing  with all courses headers by due date if its matching removing completed courses headers.
            List <string> completedCourseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (completedCourseTitlesByDueDate.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDueDate.Count; i++)
                {
                    for (int j = 0; j < completedCourseTitlesByDueDate.Count; j++)
                    {
                        if (courseTitlesByDueDate[i] == completedCourseTitlesByDueDate[j])
                        {
                            courseTitlesByDueDate.Remove(courseTitlesByDueDate[i]);
                        }
                    }
                }
            }

            ///  8.After removing locked courses and completed courses headers getting first course header and saving it.Then clicking start now button
            string firstCourseTitleByDueDate = courseTitlesByDueDate[0];

            ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl);
            CourseTestPage CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn);

            ///  9.getting course name header and comparing with our first course header what saved above and navigating back
            string startedCourseTitleByDueDate = CTP.CourseTitleLbl.Text;

            Assert.AreEqual(firstCourseTitleByDueDate, startedCourseTitleByDueDate);
            Browser.Navigate().Back();
            Gcep.WaitForInitialize();

            Gcep.ResidentGCEPSortBYDurationBtn.Click();
            Gcep.WaitForInitialize();
            if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled"))
            {
                Gcep.ScrolltoGetAllCourses();
                Gcep.ResidentGcepShowElectiveCourseLnk.Click();
            }

            Gcep.ScrolltoGetAllCourses();

            List <string> courseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text));

            List <string> lockedCourseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (lockedCourseTitlesByDuration.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDuration.Count; i++)
                {
                    for (int j = 0; j < lockedCourseTitlesByDuration.Count; j++)
                    {
                        if (courseTitlesByDuration[i] == lockedCourseTitlesByDuration[j])
                        {
                            courseTitlesByDuration.Remove(courseTitlesByDuration[i]);
                        }
                    }
                }
            }

            List <string> completedCourseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (completedCourseTitlesByDuration.Count > 0)
            {
                for (int i = 0; i < courseTitlesByDuration.Count; i++)
                {
                    for (int j = 0; j < completedCourseTitlesByDuration.Count; j++)
                    {
                        if (courseTitlesByDuration[i] == completedCourseTitlesByDuration[j])
                        {
                            courseTitlesByDuration.Remove(courseTitlesByDuration[i]);
                        }
                    }
                }
            }

            string firstCourseTitleByDuration = courseTitlesByDuration[0];

            ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl);
            CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn);

            string startedCourseTitleByDuration = CTP.CourseTitleLbl.Text;

            Assert.AreEqual(firstCourseTitleByDuration, startedCourseTitleByDuration);

            Browser.Navigate().Back();
            Gcep.WaitForInitialize();

            Gcep.ResidentGCEPSortBYProgressBtn.Click();
            Gcep.WaitForInitialize();

            if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled"))
            {
                Gcep.ScrolltoGetAllCourses();
                Gcep.ResidentGcepShowElectiveCourseLnk.Click();
            }

            Gcep.ScrolltoGetAllCourses();

            List <string> courseTitlesProgress = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text));

            List <string> lockedCourseTitlesByProgress = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (lockedCourseTitlesByProgress.Count > 0)
            {
                for (int i = 0; i < courseTitlesProgress.Count; i++)
                {
                    for (int j = 0; j < lockedCourseTitlesByProgress.Count; j++)
                    {
                        if (courseTitlesProgress[i] == lockedCourseTitlesByProgress[j])
                        {
                            courseTitlesProgress.Remove(courseTitlesProgress[i]);
                        }
                    }
                }
            }

            List <string> completedCourseTitlesByProgress = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text));

            if (completedCourseTitlesByProgress.Count > 0)
            {
                for (int i = 0; i < courseTitlesProgress.Count; i++)
                {
                    for (int j = 0; j < completedCourseTitlesByProgress.Count; j++)
                    {
                        if (courseTitlesProgress[i] == completedCourseTitlesByProgress[j])
                        {
                            courseTitlesProgress.Remove(courseTitlesProgress[i]);
                        }
                    }
                }
            }

            string firstCourseTitleByProgress = courseTitlesProgress[0];

            ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl);
            CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn);

            string startedCourseTitleByProgress = CTP.CourseTitleLbl.Text;

            Assert.AreEqual(firstCourseTitleByProgress, startedCourseTitleByProgress);

            Browser.Navigate().Back();
            Gcep.WaitForInitialize();
        }
Ejemplo n.º 23
0
        /// <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.EditInstitutionPage.InstitutionSaveBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionSaveBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, InstitutionSaveBtn);
                    Thread.Sleep(0500);
                    InstitutionSaveBtn.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"));

                    InstitutionsPage IP = new InstitutionsPage(Browser);
                    IP.WaitForInitialize();
                    return(IP);
                }
            }
            if (Browser.Exists(Bys.EditInstitutionPage.InstitutionCancelBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionCancelBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, InstitutionCancelBtn);
                    Thread.Sleep(0500);
                    InstitutionCancelBtn.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"));

                    InstitutionsPage IP = new InstitutionsPage(Browser);
                    IP.WaitForInitialize();
                    return(IP);
                }
            }
            if (Browser.Exists(Bys.AMAPage.HelpLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == HelpLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    HelpLnk.SendKeys(Keys.Tab);
                    HelpLnk.Click();
                    HelpPage HP = new HelpPage(Browser);
                    HP.WaitForInitialize();
                    return(HP);
                }
            }
            if (Browser.Exists(Bys.AMAPage.HelpfromYourInstitutionLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == HelpfromYourInstitutionLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    HeaderMenuDropDown.Click();
                    HelpfromYourInstitutionLnk.SendKeys(Keys.Tab);
                    HelpfromYourInstitutionLnk.Click();
                    Browser.Manage().Window.Maximize();

                    Browser.SwitchTo().Window(Browser.WindowHandles.Last());
                    Browser.Manage().Window.Maximize();
                    HelpPage HP = new HelpPage(Browser);
                    HP.WaitForInitialize();
                    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);
        }
Ejemplo n.º 24
0
        public void EnterAnArticleTest()
        {
            //creating a random user with api calls
            UserInfo NewUser1 = UserUtils.CreateUser("Article");
            /// 1. Navigate to the login page and Log In
            LoginPage LP = Navigation.GoToLoginPageMainpro(browser);

            // Wrapper to login
            DashboardPage DP = LP.LoginAsUser(NewUser1.Username, "test");


            /// 2. Click on the Enter a CPD Activity Button
            DP.EULAButton.Click();



            /// 3. Fill out the Enter a CPD Activity 1st Page
            EnterACPDActivityPage EP = DP.ClickToAdvance(DP.EnterCPDActBtn);

            EP.FillEnterACPDActivityForm("Self-Learning", "Certified", "CFP Mainpro+ Articles");

            EP.ArticleDrpDn.Click();
            Thread.Sleep(1000);

            EP.AntibioticArticle.Click();
            Thread.Sleep(1000);



            EP.ContinueBtn.Click();
            Thread.Sleep(4000);
            /// 3. Fill out the Article Details for the article

            //scroll to the radio button
            ElemSet.ScrollToElement(browser, EP.ArticleDescriptionRdo);
            //EP.ArticleDescriptionRdo.Click();



            //Generate start and end dates for the article Page
            DateTime dt             = DateTime.Now.AddDays(-1);
            String   startDate      = dt.Month + "/" + dt.Day + "/" + dt.Year;
            String   completionDate = startDate;

            ElemSet.ScrollToElement(browser, EP.ActivityStartDateArticleTxt);
            EP.ActivityStartDateArticleTxt.SendKeys(startDate);
            EP.ActivityStartDateArticleTxt.SendKeys(Keys.Tab);
            ElemSet.ScrollToElement(browser, EP.ActivityCompletionDateArticleTxt);
            EP.ActivityCompletionDateArticleTxt.SendKeys(completionDate);
            EP.ActivityCompletionDateArticleTxt.SendKeys(Keys.Tab);

            ElemSet.ScrollToElement(browser, EP.SubmitButton);
            EP.SubmitButton.SendKeys(Keys.Tab);
            //perform the Selenium Click
            Browser.ExecuteScript("arguments[0].click();", EP.SubmitButton);

            //wait until the popup submit button appears
            Browser.WaitForElement(Bys.EnterACPDActivityPage.PopupSubmitBtn, ElementCriteria.IsVisible);



            Browser.ExecuteScript("arguments[0].click();", EP.PopupSubmitBtn);
            /// 4. return to the dashboard



            String TotalCreditsString = DP.CheckForCreditUpdate();

            /// 5. check to see that the Total credits are now equal to the 0.5 added by the article
            Assert.AreEqual(TotalCreditsString, "0.5");
        }
        public void MemberBenefits()

        {
            ///  1. Navigate to the login page login as a Manager or AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser(role.Username, role.Password);

            ///  2.click to CGEP link to navigate Gcep page and waiting load icon disappear
            GCEPPage          GCEP = ED.ClickToAdvance(ED.GcepLnk);
            MemberBenefitPage MPG  = GCEP.ClickToAdvance(GCEP.MemberBenefitsManagementLnk);

            ElemSet.ScrollToElement(browser, MPG.FaceBookLnk);

            List <string> benefitTitlesAMAlevel_Published = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            GCEP = MPG.ClickToAdvance(MPG.GMECompetencyEducationProgramLnk);
            GCEP.AdminSwitchBtn.Click();
            GCEP.WaitForInitialize();
            GCEP.ScrolltoGetAllCourses();
            ElemSet.ScrollToElement(Browser, GCEP.FaceBookLnk);

            List <string> benefitTitlesResidentlevel = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            Assert.AreEqual(benefitTitlesAMAlevel_Published, benefitTitlesResidentlevel);



            GCEP.GMECompetencyEducationProgramLnk.Click();
            GCEP.WaitForInitialize();
            if (BrowserName == BrowserNames.InternetExplorer)
            {
                Browser.WaitForElement(Bys.GCEPPage.MemberBenefitsManagementLnk, TimeSpan.FromSeconds(90), ElementCriteria.IsEnabled);
            }

            MPG = GCEP.ClickToAdvance(GCEP.MemberBenefitsManagementLnk);
            List <string> benefitTitlesAMAlevel_Not_Published = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 cross-sell-list-item ng-scope']/div[@class='margin-top-bottom-20 margin-bottom-15 ng-binding']")).Select(ow => ow.Text));

            if (benefitTitlesAMAlevel_Published.Count == benefitTitlesAMAlevel_Not_Published.Count)
            {
                MPG.TitleTxt.SendKeys("newBenefit");
                MPG.URLTxt.SendKeys("www.google.com");
                FileUtils.UploadFileUsingSendKeys(Browser, MPG.MembershipFormBrowseHiddenBtn, Bys.MemberBenefitPage.MembershipFormBrowseHiddenBtn, @"C:\upload\physician_save_0.jpg");
                MPG.SaveBtn.Click();
                MPG.WaitForInitialize();
            }
            ElemSet.ScrollToElement(Browser, MPG.PublishBtn);
            Thread.Sleep(500);
            MPG.PublishBtn.Click();
            MPG.WaitForInitialize();
            List <string> benefitTitlesAMAlevel_Published_firstTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            GCEP = MPG.ClickToAdvance(MPG.GMECompetencyEducationProgramLnk);
            GCEP.ClickToAdvance(GCEP.SignOutLnk);

            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser("10031198", "password");
            GCEP = ED.ClickToAdvance(ED.GcepLnk);

            GCEP.ScrolltoGetAllCourses();
            ElemSet.ScrollToElement(Browser, GCEP.FaceBookLnk);

            List <string> benefitTitlesResidentlevel_firstTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            Assert.AreEqual(benefitTitlesAMAlevel_Published_firstTime, benefitTitlesResidentlevel_firstTime);
            // FileUtils.UploadFileUsingSendKeys(Browser, MPG.MembershipFormBrowseHiddenBtn, Bys.MemberBenefitPage.MembershipFormBrowseHiddenBtn, @"C:\upload\physician_save_0.jpg");
            // MPG.ChooseFileBtn.Click();

            GCEP.ClickToAdvance(GCEP.SignOutLnk);

            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser(role.Username, role.Password);
            GCEP = ED.ClickToAdvance(ED.GcepLnk);
            MPG  = GCEP.ClickToAdvance(GCEP.MemberBenefitsManagementLnk);

            IWebElement benefitToDelete = Browser.FindElement(By.XPath("//div[@class = 'margin-top-bottom-20 margin-bottom-15 ng-binding' and contains (text(),'newBenefit')]/..//span[@class='glyphicon glyphicon-remove cursor-pointer']"));

            benefitToDelete.Click();
            Thread.Sleep(500);
            MPG.AcceptBtn.Click();
            MPG.WaitForInitialize();

            MPG.PublishBtn.Click();
            MPG.WaitForInitialize();


            List <string> benefitTitlesAMAlevel_Published_secondTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            GCEP = MPG.ClickToAdvance(MPG.GMECompetencyEducationProgramLnk);
            GCEP.ClickToAdvance(GCEP.SignOutLnk);

            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser("10031198", "password");
            GCEP = ED.ClickToAdvance(ED.GcepLnk);

            GCEP.ScrolltoGetAllCourses();
            ElemSet.ScrollToElement(Browser, GCEP.FaceBookLnk);

            List <string> benefitTitlesResidentlevel_secondTime = new List <string>(Browser.FindElements(By.XPath("//div[@class='col-lg-3 col-md-3 col-sm-3 col-xs-6 ng-scope']/span")).Select(ow => ow.Text));

            Assert.AreEqual(benefitTitlesAMAlevel_Published_secondTime, benefitTitlesResidentlevel_secondTime);


            Thread.Sleep(15000);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Clicks the user-specified button, link, tab, etc. 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 void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.CBDProgDirectorPage.AddRemoveFlagFormRemoveFlagBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddRemoveFlagFormRemoveFlagBtn.GetAttribute("outerHTML"))
                {
                    AddRemoveFlagFormRemoveFlagBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.LearnersTblRowBodyVisibleAndEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == Browser.FindElement(Bys.RCPPage.CBDTab).GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDProgDirectorPage.PageReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.AddRemoveFlagFormSaveFlagBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddRemoveFlagFormSaveFlagBtn.GetAttribute("outerHTML"))
                {
                    AddRemoveFlagFormSaveFlagBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.LearnersTblRowBodyVisibleAndEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.SchedProgMeetFormScheduleBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SchedProgMeetFormScheduleBtn.GetAttribute("outerHTML"))
                {
                    SchedProgMeetFormScheduleBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.LearnersTblRowBodyVisibleAndEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.AddNotesFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddNotesFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddNotesFormSubmitBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.LearnersTblRowBodyVisibleAndEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.AssignObsFormNextBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AssignObsFormNextBtn.GetAttribute("outerHTML"))
                {
                    AssignObsFormNextBtn.Click();
                    Browser.WaitForElement(Bys.CBDProgDirectorPage.AssignObsFormBackBtn, ElementCriteria.IsEnabled);
                    Browser.WaitForElement(Bys.CBDProgDirectorPage.AssignObsFormBackBtn, ElementCriteria.IsVisible);
                    Browser.WaitForElement(Bys.CBDProgDirectorPage.AssignObsFormBackBtn, ElementCriteria.HasText);
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.AssignObsFormSearchBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AssignObsFormSearchBtn.GetAttribute("outerHTML"))
                {
                    AssignObsFormSearchBtn.Click();
                    Browser.WaitForElement(Bys.CBDProgDirectorPage.AssignObsFormObserverNameTxt, ElementCriteria.IsEnabled);
                    this.WaitForInitialize();
                    Thread.Sleep(1000);
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.AssignObsFormAssignBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AssignObsFormAssignBtn.GetAttribute("outerHTML"))
                {
                    AssignObsFormAssignBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.CompCommiteeTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CompCommiteeTab.GetAttribute("outerHTML"))
                {
                    CompCommiteeTab.Click();
                    // Note that the if this is a new environment, then this will fail because the Agenda table will not have any rows. You have to log in manually and create
                    // an agenda so that the agenda table gets rows
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.AgendaTblRowBodyVisibleAndEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.CreateNewAgendaLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateNewAgendaLnk.GetAttribute("outerHTML"))
                {
                    CreateNewAgendaLnk.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDProgDirectorPage.CreateNewAgendaFormProgramSelElemHasItemsAndIsEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.CreateNewAgendaFormCreateBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateNewAgendaFormCreateBtn.GetAttribute("outerHTML"))
                {
                    CreateNewAgendaFormCreateBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);

                    // This failed once and the screenshot showed that the load element was still there. So the above wait criteria didnt work,
                    // maybe there is a second load icon that appears. So lets condition this so that if the form did not close yet, then wait
                    // again for the load icon to disappear.
                    if (Browser.FindElements(Bys.CBDProgDirectorPage.CreateNewAgendaFormCreateBtn).Count > 0)
                    {
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                          Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    }

                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.SetStatusFormConfirmBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SetStatusFormConfirmBtn.GetAttribute("outerHTML"))
                {
                    SetStatusFormConfirmBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == FinalizeAgendaBtn.GetAttribute("outerHTML"))
                {
                    FinalizeAgendaBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.FinalizeAgendaFormFinalizeBtnIsEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaFormFinalizeBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == FinalizeAgendaFormFinalizeBtn.GetAttribute("outerHTML"))
                {
                    FinalizeAgendaFormFinalizeBtn.Click();
                    this.WaitUntilAll(TimeSpan.FromSeconds(60), Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared, Criteria.CBDProgDirectorPage.AgendaTblRowBodyVisibleAndEnabled);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, LogoutLnk);
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDirectorPage.AddSupportingDocumentationFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddSupportingDocumentationFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddSupportingDocumentationFormSubmitBtn.Click();
                    this.WaitUntilAll(Criteria.CBDProgDirectorPage.LearnersTblRowBodyVisibleAndEnabled,
                                      Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide,
                                      Criteria.CBDProgDirectorPage.LoadElementDisappeared);
                    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.");
            }
        }
        public void CourseTracker_Resident_RequiredCoursePass()
        {
            ///  1.Navigate to the login page login as a AMA staff
            UserInfo            role = UserUtils.GetUser(UserRole.Ama_Staff);
            LoginPage           LP   = Navigation.GoToLoginPage(browser);
            EducationCenterPage ED   = LP.LoginAsUser("10021373", "password");

            if (BrowserName == BrowserNames.Firefox)
            {
                Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
            }

            ///  2.click to GCEP link  navigate to Gcep page and waiting load icon disappear
            GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk);


            string CourseTracker = Gcep.ResidentCourseTrackerLbl.Text;

            if (!CourseTracker.Contains('/'))
            {
                if (!CourseTracker.Contains("0"))
                {
                    string[] CourseTrackernotNull = CourseTracker.Split(' ');
                    int      regCoursCount        = Convert.ToInt16(CourseTrackernotNull[3]);
                }
                else
                {
                    string[] CoursetrackerwithNull = CourseTracker.Split(' ');
                    int      NoRegCourse           = Convert.ToInt16(CoursetrackerwithNull[2]);
                }
                Gcep.ClickToAdvance(Gcep.SignOutLnk);

                LP = Navigation.GoToLoginPage(browser);
                ED = LP.LoginAsUser(role.Username, role.Password);
                if (BrowserName == BrowserNames.Firefox)
                {
                    Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled);
                }
                Gcep = ED.ClickToAdvance(ED.GcepLnk);

                ///  3.from Gcep navigating to institution managment searching for institution looking for curriculum and if their any curriculum with the same name deleting and starting create new curriculum.
                InstitutionsPage     Instute1 = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk);
                InstitutionsGCEPPage InsGcep1 = Instute1.SearchforInstitutions("Ellis Hospital");

                ProgramsPage Program1 = InsGcep1.ClickToAdvance(InsGcep1.InstitutionProgramManagmentLnk);
                Program1.UnassignCurriculum();


                CurriculumMngPage Curriculum1 = InsGcep1.ClickToAdvance(InsGcep1.InstitutionCurriculumTmpLnk);
                Curriculum1.Search("Learning111!!!");
                Curriculum1.DeleteCurriculum("Learning111!!!");
                CurriculumCoursePage CurCoursPage = Curriculum1.ClickToAdvance(Curriculum1.CreateCurriculumTemplateBtn);

                ///  4.Form course page choosing available courses from table by index
                CurCoursPage.AddOrRemoveCourses(CurCoursPage.AvailableCoursesTbl, CurCoursPage.AddSelectedBtn, 8, 9, 10, 11, 12, 13, 14, 15, 16);

                // List<string> CourseNames = new List<string>();
                List <string> CourseNames = CurCoursPage.GetTheNamesChoosenCourses();


                int CountofCoursewasAssigned = CourseNames.Count;


                ///  5. Giving the name for curriculum passing parameter from TestCase as a string
                CurCoursPage.CurriculumNameTxt.Clear();
                CurCoursPage.CurriculumNameTxt.SendKeys("Learning111!!!");

                ///  6.Saving curriculum and navigating to the pgy pages to assigne course to students
                PGYAssignmentPage PGY = CurCoursPage.ClickToAdvance(CurCoursPage.NextBtn);

                ///  7.Choosing student years to assign course by index for each course
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 1, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 2, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 3, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 4, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 5, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 6, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 7, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 8, 4);
                PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 9, 4);


                ///  8. Saving curriculum and navigating to curriculum management page again
                PGY.ClickToAdvance(PGY.SaveExitBtn);

                /// 9.Finding curriculum what we create and assigning to the programm
                Curriculum1.Search("Learning111!!!");
                Curriculum1.Actioncell.Click();
                AssignProgramPage Assign = Curriculum1.ClickToAdvance(Curriculum1.AssignToProgrammLnk);

                ///  10.Choosing starting date and ending date for  program  and clicking next button
                string StartingDate = Assign.ChoosingStartDate();
                string EndingDate   = Assign.ChoosingEndDate(1, "MM/d/yyyy");
                Assign.AssignProgramm();
                AssignSummaryPage Summary = Assign.ClickToAdvance(Assign.NextBtn);

                ///  11.Verifying from Assign Summary page program is displayed
                Assert.IsTrue(Summary.CreatedProgramName.Displayed);
                Assert.AreEqual((Summary.CreatedProgramName.Text), "Learning111!!!");

                ///  12.Verifying Assing confirmation test page curriculum name and starting date and ending dates are there which we choose.
                AssignConfirmationPage Confirmation = Summary.ClickToAdvance(Summary.NextBtn);
                // Assert.IsTrue(Confirmation.Grid_CellTextFound(Confirmation.ProgramSummaryTbl, StartingDate + " - " + EndingDate));
                Thread.Sleep(0500);
                Confirmation.ConfirmBtn.Click();

                ///  13.Signing out and Signing in as a Resindent counting required courses from myRequiredCourses
                Curriculum1.ClickToAdvance(Curriculum1.SignOutLnk);

                Thread.Sleep(2500);
                LP   = Navigation.GoToLoginPage(browser);
                ED   = LP.LoginAsUser("10021373", "password");//10021375,10021377,21387
                Gcep = ED.ClickToAdvance(ED.GcepLnk);
                //Assert.True(Gcep.VerificationOfChoosenCoursesAssignedForResident(browser, CourseNames), "Course count are not equal");
                Thread.Sleep(2000);
                string   CourseTrackerAfterAssignment = Gcep.ResidentCourseTrackerLbl.Text;
                string[] courseword2 = CourseTrackerAfterAssignment.Split(' ');
                //string[] countofcourses1 = courseword2[2].Split('/');
                //string[] courseword = CourseTracker.Split(' ');
                int CountofcoursesOnResidentGcepaftercourseAssignment = Convert.ToInt16(courseword2[3]);

                Thread.Sleep(2000);
                int CountofcoursesOnResidentGcepaftercourseAssigmentCompleted = Convert.ToInt16(courseword2[2]);

                Thread.Sleep(2000);

                Assert.True(CountofcoursesOnResidentGcepaftercourseAssignment.Equals(CountofCoursewasAssigned));
            }
            do
            {
                ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk);
            }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed);


            ElemSet.ScrollToElement(browser, Gcep.ResidentCourseTrackerLbl);

            CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, "AUTOMATION_002");


            Gcep = Course.TestPass();

            do
            {
                ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk);
            }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed);

            Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, "AUTOMATION_002", "View Certificate"), "View Certificet button not visible");

            string CourseTrackerAfterTestCompletion = Gcep.ResidentCourseTrackerLbl.Text;

            string[] courseword3 = CourseTrackerAfterTestCompletion.Split(' ');
            int      CountOfCompletedRegCourseafterPassingTest = Convert.ToInt16(courseword3[2]);

            //int some = CountofcoursesOnResidentGcepaftercourseAssigmentCompleted + 1;
            //Assert.True(CountofcoursesOnResidentGcepaftercourseAssigmentCompleted + 1 == (CountOfCompletedRegCourseafterPassingTest));
            Gcep.ClickToAdvance(Gcep.SignOutLnk);

            Thread.Sleep(2500);
            LP   = Navigation.GoToLoginPage(browser);
            ED   = LP.LoginAsUser(role.Username, role.Password);//10021375,10021377,21387
            Gcep = ED.ClickToAdvance(ED.GcepLnk);

            InstitutionsPage     Instute = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk);
            InstitutionsGCEPPage InsGcep = Instute.SearchforInstitutions("Ellis Hospital");

            ProgramsPage Program = InsGcep.ClickToAdvance(InsGcep.InstitutionProgramManagmentLnk);

            Program.UnassignCurriculum();

            CurriculumMngPage Curriculum = InsGcep.ClickToAdvance(InsGcep.InstitutionCurriculumTmpLnk);

            Curriculum.Search("Learning111!!!");
            Curriculum.DeleteCurriculum("Learning111!!!");
        }
 /// <summary>
 /// Clicks on the user-specified milestone link in the <> table from the trainee dashboard page and waits for that page to appear
 /// </summary>
 /// <param name="milestoneName">The trainee's first and last name</param>
 public void GoToSpecificMilestone(string milestoneName)
 {
     ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]);
     ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, MilestonesTbl, Bys.PERAssessorPage.MilestonesTblFirstRow, milestoneName, null, milestoneName);
     this.WaitUntilAll(Criteria.PERAssessorPage.MarkAsAchievedBtnVisible);
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Clicks the user-specified button, link, tab, etc. 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 void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.CBDProgDeanPage.LearnersTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LearnersTab.GetAttribute("outerHTML"))
                {
                    LearnersTab.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == Browser.FindElement(Bys.RCPPage.CBDTab).GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDProgDeanPage.PageReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddRemoveFlagFormRemoveFlagBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddRemoveFlagFormRemoveFlagBtn.GetAttribute("outerHTML"))
                {
                    AddRemoveFlagFormRemoveFlagBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddRemoveFlagFormSaveFlagBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddRemoveFlagFormSaveFlagBtn.GetAttribute("outerHTML"))
                {
                    AddRemoveFlagFormSaveFlagBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddNotesFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddNotesFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddNotesFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, LogoutLnk);
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDProgDeanPage.AddSupportingDocumentationFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddSupportingDocumentationFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddSupportingDocumentationFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LearnersTblBodyRowVisibleAndEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDProgDeanPage.LoadElementDoneLoading);
                    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 void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.CBDLearnerPage.BackBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == BackBtn.GetAttribute("outerHTML"))
                {
                    BackBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(180), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectBtn.GetAttribute("outerHTML"))
                {
                    // NOTE: This sometimes does not work in Firefox whenever the tooltip for one of the tabs appears. Firefox
                    // fails to click when a tooltip is covering the button. However, this started working today. If it stops
                    // working again, we will have to implement a workaround in the SwitchTabs method
                    AddReflectBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormContinueBtn);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormContinueBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    this.WaitUntil(TimeSpan.FromSeconds(360), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.AddReflectFormBrowseBtn, ElementCriteria.IsVisible);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormSubmitBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithReflectionsTabReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObservationBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObservationBtn.GetAttribute("outerHTML"))
                {
                    RequestObservationBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.RequestObsFormObsNameTxt);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormObsNameTxt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //Browser.WaitForElement(Bys.CBDLearnerPage.RequestObsFormSearchBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    // Need to revisit the above 2 lines. For some reason, this needs a tiny static wait to work sometimes
                    //Thread.Sleep(0600);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormSearchBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormSearchBtn.GetAttribute("outerHTML"))
                {
                    // 11/30/17: It failed today. Said "Failed to find any elements By.XPath: //tbody[@aria-label='Select Observer']"
                    // I looked on the screenshot and the radio button never got returned, even though the label beneath it said
                    // "Showing 1-1 of 1". This tells me that this is an application bug. Hopefully this fixes itself when DEV works
                    // on performance improvements. If not, and I see this again, I might have to add some more logic below to keep
                    // clicking or something else
                    // 11/05/17: For some reason, selenium sometimes fails to click this button. So I am adding a Catch and using javascript based click event if this fails
                    try
                    {
                        RequestObsFormSearchBtn.Click();
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.RequestObsFormRdoBtnTbodyVisible,
                                          Criteria.CBDLearnerPage.RequestObsFormFirstRdoVisible);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        // Adding a Sleep here for now until I have time to come back and add some dynamic wait criteria
                        Thread.Sleep(0300);
                    }
                    catch
                    {
                        ((IJavaScriptExecutor)Browser).ExecuteScript("arguments[0].click()", RequestObsFormSearchBtn);
                        this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormRdoBtnTbody, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible);
                        this.WaitUntilAll(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                        // Adding a Sleep here for now until I have time to come back and add some dynamic wait criteria
                        Thread.Sleep(0300);
                    }
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormRequestBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormRequestBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormRequestBtn.Click();
                    this.WaitForElement(Bys.CBDLearnerPage.RequestObsFormOkBtn, ElementCriteria.IsVisible);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.RequestObsFormOkBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == RequestObsFormOkBtn.GetAttribute("outerHTML"))
                {
                    RequestObsFormOkBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, LogoutLnk);
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.AddReflectFormContinueBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddReflectFormContinueBtn.GetAttribute("outerHTML"))
                {
                    AddReflectFormContinueBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.AddReflectFormBrowseBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ViewMoreRptsLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ViewMoreRptsLnk.GetAttribute("outerHTML"))
                {
                    ViewMoreRptsLnk.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDLearnerPage.ReportsFormShowBtn);
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.LoadElementDoneLoading);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormShowBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormShowBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormShowBtn.Click();
                    Browser.WaitForElement(Bys.CBDLearnerPage.ReportsFormEPAObservCntChrt, ElementCriteria.IsVisible, ElementCriteria.IsEnabled, ElementCriteria.HasText);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDLearnerPage.ReportsFormCloseBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ReportsFormCloseBtn.GetAttribute("outerHTML"))
                {
                    ReportsFormCloseBtn.Click();
                    this.WaitUntil(TimeSpan.FromSeconds(120), Criteria.CBDLearnerPage.PageReadyWithProgramLearningTabReady);
                    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.");
            }
        }