public BRBaseWidget GetRow(string item) { string sel = "//tbody/tr//*[contains(text(), '" + item + "')]//parent::tr"; BRBaseWidget row = new BRBaseWidget(sel, LocatorTypes.XPATH, "tablerow", "Table Row"); return(row); }
public bool SearchFor(string item) { SendKeys(item); string sel = "//div[@class='numbers' and contains(text(),'" + item + "')]"; BRBaseWidget searchResults = new BRBaseWidget(sel, LocatorTypes.XPATH, "searchresults", "Search Results"); try { searchResults.WaitTilIsVisible(5); SendEnter(); return(true); } catch (Exception) { sel = "//div[@class='displayname' and contains(text(),'" + item + "')]"; searchResults = new BRBaseWidget(sel, LocatorTypes.XPATH, "searchresults", "Search Results"); try { searchResults.WaitTilIsVisible(1); SendEnter(); } catch (Exception) { sel = "//div[@class='select2-result-label' and contains(text(),'" + item + "')]"; searchResults = new BRBaseWidget(sel, LocatorTypes.XPATH, "searchresults", "Search Results"); searchResults.WaitTilIsVisible(1); SendEnter(); } return(true); } //return false; }
public bool DoesRowExist(string item) { string sel = "//tbody/tr//*[contains(text(), '" + item + "')]"; BRBaseWidget row = new BRBaseWidget(sel, LocatorTypes.XPATH, "tableitem", "Table Item"); return(row.DoesExist()); }
public virtual string GetPropertyValue(string prop) { string tableSel = @"table.table.table-condensed"; string propValue = "The value was not found"; BRBaseWidget table = new BRBaseWidget(tableSel, LocatorTypes.CSS, "table", "Field Set "); IReadOnlyCollection <IWebElement> tableRows = table.FindElements(By.CssSelector(@"tr.table-row")); if (tableRows.Count > 0) { foreach (IWebElement row in tableRows) { // Check the cell - and get the value from the second cell IReadOnlyCollection <IWebElement> cells = row.FindElements(By.TagName("td")); if (cells.Count > 0) { if (cells.ElementAt(0).Text == prop + ":") { return(cells.ElementAt(1).Text); } } } } else { // throw new XPOException("There are no table rows available."); } return(propValue); }
public bool WaitTilReady() { string sel = FieldSet.Locator + "/following-sibling::/div/div[@id='loadingspinner']"; BRBaseWidget spinner = new BRBaseWidget(sel, LocatorTypes.CSS, "fieldset", "Field Set"); spinner.WaitTilNotVisible(); return(true); }
public void Filter(string search, string valueToFilter) { // RIGHT now, this works one at a time! // This needs to be updated if we want to do more than one filter at a time. FindElement(Locator).Click(); string sel = @"div.popover.filterpop[data-criteria=""" + m_dataCriteria + @"""]"; BRBaseWidget w = new BRBaseWidget(sel, LocatorTypes.CSS, "PopOver", "PopOver"); sel = @"input#s2id_autogen4"; IWebElement f = FindElement(w.Locator).FindElement(By.CssSelector(sel)); //XPOLogger.LogInfo("In the filter textbox, enter: '" + search + "' and click enter."); f.SendKeys(search); // f.SendKeys(Keys.Enter); string liSel = @"li.select2-results-dept-0.select2-result.select2-result-selectable"; IReadOnlyCollection <IWebElement> availULs = Browser.FindElements(By.CssSelector("ul.select2-results")); if (availULs.Count > 0) { foreach (IWebElement ul in availULs) { if (ul.Displayed) { // CurrentPage.WaitTilElementIsVisible(liSel); IReadOnlyCollection <IWebElement> lineItems = ul.FindElements(By.CssSelector(liSel)); if (lineItems.Count > 0) { foreach (IWebElement li in lineItems) { if (li.Text.ToLower().Equals(valueToFilter.ToLower())) { //XPOLogger.LogInfo("In the list of available choices, click '" + valueToFilter + "'."); // make sure to document li.Click(); // CurrentPage.WaitTilTruckDoneLoading(); this.Click(); return; } } //throw new XPOException("The menu item was not found."); } else { // throw new XPOException("The list of menu items was not found."); } } } } }
public bool SelectItem(string item) { bool WasSelected = false; Open.Click(); //open the dropdown BRBaseWidget m_dropDownList = DropDownList; m_dropDownList.WaitTilIsVisible(); string sel = "//li/div[contains(@class, 'select2-result-label')][contains(text(),'" + item + "')]"; BRBaseWidget m_theItem = new BRBaseObjects.BRBaseWidget(sel, LocatorTypes.XPATH, "dropdownItem", item); m_theItem.WaitTilIsVisible(); m_theItem.Click(); WasSelected = true; return(WasSelected); }
public bool SelectItem(string item) { SendKeys(item); string sel = "//li/a/b[contains(text(),'" + item + "')]"; BRBaseWidget m_item = new BRBaseWidget(sel, LocatorTypes.XPATH, "dropdownmenuitem", "Drop Down Menu Item"); try { m_item.WaitTilIsVisible(); m_item.Click(); } catch (Exception) { sel = "//li/a[contains(text(),'" + item + "')]"; m_item = new BRBaseWidget(sel, LocatorTypes.XPATH, "dropdownmenuitem", "Drop Down Menu Item"); m_item.WaitTilIsVisible(); m_item.Click(); } return(true); }