/// <summary> /// Return a list of all options available in the left pane menu /// </summary> /// <returns> /// Return the list of all available options on the left side bar menu /// </returns> public List <MenuOption> GetAllMenuOptions() { string section = ""; listMenuOptions = new List <MenuOption>(); IWebElement mainSideBar = CTX.driver.FindElement(By.XPath(".//div[@class='" + sideBarClass + "']")); ReadOnlyCollection <IWebElement> listMenuOptionsWe = mainSideBar.FindElements(By.XPath(".//span[@class='sidebar-mini-hidden']")); foreach (var elem in listMenuOptionsWe) { IWebElement weParent = WebElementHelper.SafeFindElement(elem, By.XPath("..")); // Assumes that a span with an A parent is a header if (weParent.GetAttribute("tagName").ToUpper() == "A") { listMenuOptions.Add(new MenuOption(elem.Text, section, elem)); } else { section = elem.Text; } } return(listMenuOptions); }
/// <summary> /// This method sets the email as HubUser and validates the email is not generating an 'Invalid email address' /// warning /// /// </summary> /// <param name="email">The email to be used as new user identifier</param> private void _SetNewUserEmail(string email) { IWebElement emailSection = _GetNewUserCellRoot(TABLE_COLUMN.HubUser); IWebElement emailInput = emailSection.FindElement(By.XPath(".//input[@data-testid='validEmailCell']")); emailInput.SendKeys(email); _GetNewUserCellRoot(TABLE_COLUMN.FirstName, false).Click(); // Assert the inserted email did not cause issues Assert.Null(WebElementHelper.SafeFindElement(emailSection, By.XPath(".//span[@data-testid='warningLabel']"))); }
/// <summary> /// Find the add button in the HubSettings page and click on it /// /// </summary> public UserManagementForm ClickButtonAddUser() { // TODO: Requires to have an ID assigned to the button of a close locator var weRoot = GetRoot(); IWebElement iElement = weRoot.FindElement( By.XPath("//*[@id='hubSettings-component']/div/div[1]/div[2]/div[2]/div/div[1]/div/div[2]/div[1]/button")); while (WebElementHelper.SafeFindElement(weRoot, By.XPath(".//input[@data-testid='validEmailCell']")) == null) { iElement.Click(); } Thread.Sleep(1000); return(new UserManagementForm(weRoot)); // //background-image: url("/Scripts/react/prod/dc3cae90d0e353eef3ad6c94a893f3c2.jpg"); // ReadOnlyCollection<IWebElement> listElements = GetRoot().FindElements( // By.XPath("*[contains(@style,'background-image: url(')]")); // IWebElement wButton = listElements[0].FindElement(By.XPath(".//div[2]/div[1]/button")); }