/// <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.InstitutionsPage.EditInstitutionLnk)) { if (buttonOrLinkElem.GetAttribute("id") == EditInstitutionLnk.GetAttribute("id")) { EditInstitutionLnk.Click(); EditInstitutionPage EIP = new EditInstitutionPage(Browser); EIP.WaitForInitialize(); return(EIP); } } if (Browser.Exists(Bys.AMAPage.AdministrationLnk)) { if (buttonOrLinkElem.GetAttribute("id") == GMECompetencyEducationProgramLnk.GetAttribute("id")) // AdministrationLnk.GetAttribute("outerHTML")) { GMECompetencyEducationProgramLnk.Click(); // AdministrationLnk.Click(); GCEPPage GP = new GCEPPage(Browser); GP.WaitForInitialize(); return(GP); } } 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> /// searching for a specific Institutions and getting contact email adress and saving them on the List of strings /// </summary> /// <param name="browser"></param> /// <param name="Institutions">the List of Institutions for which you are looking email adress </param> /// <returns></returns> public static List <string> GetTheInstutionsEmail(IWebDriver browser, List <string> Institutions) { EditInstitutionPage EIP = new EditInstitutionPage(browser); InstitutionsPage IP = new InstitutionsPage(browser); List <string> InstitutionContactEmails = new List <string>(); // Starting the for loop on the 2nd row (index = 1) on the for loop here because when we extracted the values from the dropdown // above, the first value was not an institution, it was a static "Select your item" text for (var i = 1; i < Institutions.Count; i++) { IP.Search(Institutions[i]); IP.ActionGearBtn.Click(); Thread.Sleep(0500); EIP = IP.ClickToAdvance(IP.EditInstitutionLnk); InstitutionContactEmails.Add(EIP.InstitutionPrimaryContactEmailTxt.GetAttribute("value")); IP = EIP.ClickToAdvance(EIP.InstitutionCancelBtn); } return(InstitutionContactEmails); }