/// <summary> /// Click on AdvancedSearch Link /// </summary> /// <param name="tabName">This is Search Tab enum</param> private void ClickonAdvancedSearchLink(string activityName, SearchTab tabName) { //Click on AdvancedSearch Link Logger.LogMethodEntry("AdvancedSearchPage", "ClickonAdvancedSearchLink", base.IsTakeScreenShotDuringEntryExit); switch (tabName) { //Click on AdvancedSearch Link in Curriculum Tab case SearchTab.Curriculum: //Check Activity Assign To Copy State new ContentLibraryPage(). CheckActivityAssignToCopyStateInCurriculumTab(activityName); //Click on Advanced Search Link new ContentLibraryPage().ClickOnAdvancedSearchLink(); //Select Curriculum Window base.WaitUntilWindowLoads(AdvancedSearchPageResource. AdvancedSearch_Page_Window_TitleName); base.SelectWindow(AdvancedSearchPageResource. AdvancedSearch_Page_Window_TitleName); //Switch to Frame base.WaitForElement(By.Id(AdvancedSearchPageResource. AdvancedSearch_Page_Frame_Id_Locator)); base.SwitchToIFrame(AdvancedSearchPageResource. AdvancedSearch_Page_Frame_Id_Locator); break; //Click on AdvancedSearch Link in Planner Tab case SearchTab.Planner: //Check Activity Assign To Copy State new CalendarDefaultGlobalUXPage(). CheckActivityAssignToCopyStateInPlannerTab(activityName); //Click on Advanced Search Link new CalendarDefaultGlobalUXPage().ClickOnAdvancedSearchLink(); //Select Planner Window base.WaitUntilWindowLoads(AdvancedSearchPageResource. AdvancedSearch_Page_PlannerWindow_TitleName); base.SelectWindow(AdvancedSearchPageResource. AdvancedSearch_Page_PlannerWindow_TitleName); //Switch to Frame base.WaitForElement(By.Id(AdvancedSearchPageResource. AdvancedSearch_Page_PlannerFrame_Id_Locator)); base.SwitchToIFrame(AdvancedSearchPageResource. AdvancedSearch_Page_PlannerFrame_Id_Locator); break; } Logger.LogMethodExit("AdvancedSearchPage", "ClickonAdvancedSearchLink", base.IsTakeScreenShotDuringEntryExit); }
public void VerifyAddNewComputer(string name) { Assert.That(AlertMessage.Text, Is.EqualTo("Done! Computer " + name + " has been created"), "Computer not added"); Console.WriteLine(AlertMessage.Text); SearchTab.SendKeys(name); SearchTab.SendKeys(Keys.Enter); Thread.Sleep(1000); var cellText = ""; var exit = false; webDriver.SwitchTo().DefaultContent(); var table = WaitUntilTagIsVisible("tbody"); var rows = table.FindElements(By.TagName("tr")); foreach (IWebElement element in rows) { if (exit) { break; } IList <IWebElement> candidateData = element.FindElements(By.TagName("td")); foreach (IWebElement elements in candidateData) { cellText = elements.Text; if (cellText == name) { exit = true; Console.WriteLine("Computer was successfully added"); break; } } } if (cellText != name) { Assert.That(cellText, Is.EqualTo(name), "Computer not added"); } }
/// <summary> /// Search Asset Using Advanced Search /// </summary> /// <param name="activityName">This is Activity Name</param> /// /// <param name="tabName">This is Search Tab Enum</param> public void SearchAssetUsingAdvancedSearch(string activityName, SearchTab tabName) { //Search Asset Using Advanced Search Logger.LogMethodEntry("AdvancedSearchPage", "SearchAssetUsingAdvancedSearch", base.IsTakeScreenShotDuringEntryExit); try { //Select Curriculum or Planner Tab this.ClickonAdvancedSearchLink(activityName, tabName); Thread.Sleep(Convert.ToInt32(AdvancedSearchPageResource. AdvancedSearch_Page_Window_TimeValue)); //Switch to Advanced Search LightBox Frame base.WaitForElement(By.Id(AdvancedSearchPageResource. AdvancedSearch_Page_AdvancedSearch_Frame_Id_Locator)); base.SwitchToIFrame(AdvancedSearchPageResource. AdvancedSearch_Page_AdvancedSearch_Frame_Id_Locator); //Clear TextBox base.WaitForElement(By.Id(AdvancedSearchPageResource. AdvancedSearch_Page_TextBox_Id_Locator)); base.ClearTextById(AdvancedSearchPageResource. AdvancedSearch_Page_TextBox_Id_Locator); //Enter Search Text base.FillTextBoxById(AdvancedSearchPageResource. AdvancedSearch_Page_TextBox_Id_Locator, activityName); //Click on Search Button base.ClickButtonById(AdvancedSearchPageResource. AdvancedSearch_Page_Search_Button_Id_Locator); base.WaitUntilWindowLoads(AdvancedSearchPageResource.AdvancedSearch_Page_Window_TitleName); base.SelectWindow(AdvancedSearchPageResource.AdvancedSearch_Page_Window_TitleName); } catch (Exception e) { ExceptionHandler.HandleException(e); } Logger.LogMethodExit("AdvancedSearchPage", "SearchAssetUsingAdvancedSearch", base.IsTakeScreenShotDuringEntryExit); }