/// <summary> /// Change to tab/subtab specified /// </summary> /// <param name="tab">name of top level tab</param> /// <param name="dropDownItem">name of submenu item</param> public static void ChangeTab(string tab, string dropDownItem = null) { //locate the tab link and click it WaitHelpers.WaitForElementVisible(By.CssSelector(".nav.top-tab-bar")); WaitHelpers.WaitForClickable(By.CssSelector(".nav.top-tab-bar")); IWebElement tabStrip = WebDriverFactory.LastDriver.FindElement(By.CssSelector(".nav.top-tab-bar")); var xpathLocator = $"//a[descendant::div[contains(@id,\"DetailView_{tab}\")]] | //a[descendant::div[contains(@id,'DetailView_') and contains(.,\"{tab}\")]]"; WaitHelpers.WaitForElementVisible(By.XPath(xpathLocator)); IWebElement tabToClick = WaitHelpers.WaitForClickable(tabStrip.FindElement(By.XPath(xpathLocator))); WaitHelpers.ExplicitWait(); tabToClick.Click(); //if drop-down, click the drop-down item if (!string.IsNullOrEmpty(dropDownItem)) { //IWebElement element = WebDriverFactory.LastDriver.ExecuteJavaScript<IWebElement>("return $" + "(\"a:has(div:contains(\'Demographics\'))\").filter(\":visible\")" + ".get(0)"); //element.DrawHighlight(); //var els = tabToClick.FindElements(By.XPath($"//a[descendant::div[contains(.,\"{dropDownItem}\")]]")); //foreach (var e in els) //{ // if (e.Displayed) { e.Click(); } //} //IWebElement dropDownToClick = WaitHelpers.WaitForClickable(tabToClick.FindElement(By.XPath($"//a[descendant::div[contains(.,\"{dropDownItem}\")]]"))); //dropDownToClick.Click(); WebDriverFactory.LastDriver.FindElement(CustomBy.jQuery($"(\"a:has(div:contains(\'{dropDownItem}\'))\").filter(\":visible\")")).Click(); } WaitHelpers.WaitForAjaxLoad(); }
/// <summary> /// Gets current value of Kendo ComboDropdown /// </summary> /// <param name="ele">IWebElement Kendo ComboDropDown</param> /// <returns>Current selected value of the combo</returns> public static string GetCurrentValueofComboDropdown(this IWebElement ele) { CheckDom(); ele.DrawHighlight(); var x = WebDriverFactory.LastDriver .FindElement(CustomBy.jQuery( $"(\"#{ele.GetAttribute("aria-owns").Replace("_listbox", "_option_selected")}\")")); //By.Id($"{ele.GetAttribute("aria-owns").Replace("_listbox", "_option_selected")}"); return WebDriverFactory.LastDriver .FindElement(CustomBy.jQuery($"(\"#{ele.GetAttribute("aria-owns").Replace("_listbox", "_option_selected")}\")")).GetClass().Contains("k-state-selected") ? WebDriverFactory.LastDriver .FindElement(CustomBy.jQuery($"(\"#{ele.GetAttribute("aria-owns").Replace("_listbox", "_option_selected")}\")")).GetAttribute("innerHTML") : string.Empty; }
public static By RelatedOrgName(string orgId) => CustomBy.DataTestId($"related-org-name-{orgId.ToLower()}");
public static By RemoveLink(string orgId) => CustomBy.DataTestId($"related-org-remove-{orgId.ToLower()}");
/// <summary> /// Get a list of the capabilities for the chosen solution /// </summary> /// <param name="solution"></param> /// <returns>List of capability names</returns> public IList <string> GetCapabilitiesForSolution(IWebElement solution) { IList <IWebElement> capabilities = solution.FindElements(CustomBy.DataTestId("capability-section-value")); return(capabilities.Select(s => s.Text).ToList()); }
/// <summary> /// Get list of features for a particular solution /// </summary> /// <param name="solution"></param> /// <returns>List of names of features</returns> public IList <string> GetFeaturesForSolution(IWebElement solution) { return(solution.FindElements(CustomBy.DataTestId("features-value")).Select(s => s.Text).ToList()); }
/// <summary> /// Ensure each solution has a summary section /// </summary> /// <returns></returns> public bool SolutionHasSummary() { IWebElement solution = GetFirstSolution(); return(solution.FindElement(CustomBy.DataTestId("summary-section-value")).Displayed); }
public static By OrganisationLinksId(string id) => CustomBy.DataTestId($"org-name-{id}");