/// <summary> /// Clicks the user-specified element that exists on the base page of cme, 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 element to click on</param> public dynamic ClickAndWaitBasePage(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.Page.ProjectsTab)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == ProjectsTab.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); ProjectsPage page = new ProjectsPage(Browser); page.WaitForInitialize(); return(page); } } if (Browser.Exists(Bys.Page.DistributionTab)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == DistributionTab.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); DistributionPage page = new DistributionPage(Browser); page.WaitForInitialize(); return(page); } } 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); }
private void ProjectsButtonClick(object sender, RoutedEventArgs e) { var header = new TabHeader(); header.HeaderText = "Projects"; header.Closing += OnTabCloseRequest; var tab = new TabItem() { Header = header, }; var projectsTab = new ProjectsTab(); tab.Content = projectsTab; projectsTab.ProjectsToDisplay = DatabaseAccess.GetEntitiesOfType <Project>() as List <Project>; tab.InvalidateArrange(); tabViewer.Items.Add(tab); tabViewer.SelectedItem = tab; UpdateLayout(); }