public List <IWebElement> DestinationErrors() { var list = WrappedElement.FindElements(_byDestinationError).ToList(); list.AddRange(WrappedElement.FindElements(_byDestinationError2).ToList()); return(list); }
/// <summary> /// Gets the column (zero-based). Returns null if there is no such column. /// </summary> /// <param name="columnIndex">Index of the column.</param> /// <returns></returns> public virtual IWebElement GetColumn(int columnIndex) { var selector = By.CssSelector($"td:nth-child({columnIndex + 1})"); var col = WrappedElement.FindElements(selector).FirstOrDefault(); return(col); }
/// <summary> /// Finds all <see cref="NgWebElement" />s within the current context /// using the given mechanism. /// </summary> /// <param name="by">The locating mechanism to use.</param> /// <returns> /// A <see cref="ReadOnlyCollection{T}" /> of all <see cref="NgWebElement" />s /// matching the current criteria, or an empty list if nothing matches. /// </returns> public ReadOnlyCollection <NgWebElement> FindElements(By by) { if (by is JavaScriptBy scriptBy) { scriptBy.AdditionalScriptArguments = new object[] { NgDriver.RootElement, WrappedElement } } ; NgDriver.WaitForAngular(); return(new ReadOnlyCollection <NgWebElement>(WrappedElement.FindElements(by) .Select(e => new NgWebElement(NgDriver, e)).ToList())); } IWebElement ISearchContext.FindElement(By by) { return(FindElement(by)); } ReadOnlyCollection <IWebElement> ISearchContext.FindElements(By by) { if (by is JavaScriptBy scriptBy) { scriptBy.AdditionalScriptArguments = new object[] { NgDriver.RootElement, WrappedElement } } ; NgDriver.WaitForAngular(); return(new ReadOnlyCollection <IWebElement>(WrappedElement.FindElements(by) .Select(e => (IWebElement) new NgWebElement(NgDriver, e)).ToList())); } #endregion } }
/// <summary> /// Gets the tab names. /// </summary> /// <returns></returns> public virtual IReadOnlyCollection <string> GetTabNames() { return(WrappedElement .FindElements(configuration.TabHeaderNamesSelector) .Select(e => e.TextHelper().InnerText) .ToList() .AsReadOnly()); }
public Calendar OpenDepartureCalendar() { if (!Driver.FindElements(_byDepartureCalendar).Any(el => el.Displayed)) //In new searchForm departureCalendar is autoOpened { WrappedElement.FindElements(_byDateFields)[2].Click(); Wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(_byDepartureCalendar)); } return(new Calendar(Driver.FindElement(_byDepartureCalendar))); }
public Calendar OpenArrivalCalendar(bool destination) //bool destination depricated now { if (!Driver.FindElements(_byArrivalCalendar).Any(el => el.Displayed)) //After filling destination field, arrivalCalendar is autoOpened { WrappedElement.FindElements(_byDateFields).First().Click(); Wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(_byArrivalCalendar)); } return(new Calendar(Driver.FindElement(_byArrivalCalendar))); }
private IWebElement FindElementByKey(string key) { IList <IWebElement> elements = WrappedElement.FindElements(By.Name(key)); if (elements.Count <= 0) { return(null); } return(elements[0]); }
public List <List <IWebElement> > GetRows() { var rows = new List <List <IWebElement> >(); var rowElements = WrappedElement.FindElements(By.XPath(".//tr")).ToList(); foreach (IWebElement rowElement in rowElements) { rows.Add(rowElement.FindElements(By.XPath(".//td")).ToList()); } return(rows); }
/// <summary> /// If overriding don't forget to call base.Load() or make sure to /// assign the WrappedElement. /// </summary> /// <returns></returns> public override ILoadableComponent Load() { base.Load(); pagerSelector = new ByChained( new ByElement(WrappedElement), By.CssSelector(".k-pager-wrap.k-grid-pager")); toolbarSelector = new ByChained( new ByElement(WrappedElement), By.CssSelector(".k-toolbar")); if (WrappedDriver.FindElements(toolbarSelector).Any()) { Toolbar = new KToolbarComponent <KGridComponent <T> >( configuration, toolbarSelector, WrappedDriver, this); pageObjectFactory.PrepareComponent(Toolbar); } else { Toolbar = null; } if (WrappedDriver.FindElements(pagerSelector).Any()) { Pager = new KPagerComponent <KGridComponent <T> >( configuration, pagerSelector, pageObjectFactory, WrappedDriver, this); pageObjectFactory.PrepareComponent(Pager); } else { Pager = null; } // Check for multi-column headers. var theadRows = WrappedElement .FindElements(By.CssSelector("thead > tr")) .ToList(); IsMultiColumnHeader = theadRows.Count > 1; return(this); }
/// <summary> /// If overriding don't forget to call base.Load() or make sure to /// assign the WrappedElement. /// </summary> /// <returns></returns> /// <exception cref="InvalidElementStateException">Expected the class " + /// "'btn-group' to be present on the WrappedElement.</exception> public override ILoadableComponent Load() { base.Load(); // Verify this is a button group. if (!WrappedElement.Is(By.CssSelector(".btn-group"))) { throw new InvalidElementStateException("Expected the class " + "'btn-group' to be present on the WrappedElement."); } // Check if split or single. IsSplitButton = WrappedElement .FindElements(By.CssSelector(".dropdown-toggle-split")) .Any(); return(this); }
/// <summary> /// Gets the buttons. /// </summary> /// <returns>The collection.</returns> public IList <IWebElement> GetButtons() { var radioName = WrappedElement.GetAttribute("name"); string xpath; if (radioName == null) { xpath = "self::* | following::input[@type = 'radio'] | preceding::input[@type = 'radio']"; } else { xpath = string.Format(CultureInfo.InvariantCulture, "self::* | following::input[@type = 'radio' and @name = '{0}'] | " + "preceding::input[@type = 'radio' and @name = '{0}']", radioName); } return(WrappedElement.FindElements(By.XPath(xpath))); }
/// <summary> /// Finds all <see cref="T:OpenQA.Selenium.IWebElement">IWebElements</see> within the current context. /// using the given mechanism. /// </summary> /// <param name="by">The locating mechanism to use.</param> /// <returns> /// A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of all /// <see cref="T:OpenQA.Selenium.IWebElement">WebElements</see> /// matching the current criteria, or an empty list if nothing matches. /// </returns> public ReadOnlyCollection <IWebElement> FindElements(By by) { return(WrappedElement.FindElements(by)); }
public List <IWebElement> GetColumn(int columnNumber) { return(WrappedElement.FindElements(By.XPath(string.Format(".//td[{0}]", columnNumber))).ToList()); }
public List <IWebElement> GetHeadings() { return(WrappedElement.FindElements(By.XPath(".//th")).ToList()); }
/// <summary> /// Checks if the 'Manage Page' link is available. /// </summary> /// <returns></returns> public virtual bool CanManagePage() { return(WrappedElement.FindElements(linkToManagePageSelector).Any()); }
public ReadOnlyCollection <UpWebElement> FindElements(By by) { UpDriver.WaitForPageReady(); Log.GetLogger().Info($"Finding elements by locator:[{by}]"); return(new ReadOnlyCollection <UpWebElement>(WrappedElement.FindElements(by).Select(el => new UpWebElement(UpDriver, el, by)).ToList())); }
/// <summary> /// Gets the table header rows. /// </summary> /// <returns></returns> public virtual IReadOnlyCollection <IWebElement> GetTableHeaderRows() { return(WrappedElement.FindElements(By.CssSelector("thead > tr"))); }
/// <summary> /// Gets the caption. Returns null if there isn't a caption. /// </summary> /// <returns></returns> public virtual IWebElement GetCaption() { return(WrappedElement .FindElements(captionSelector) .FirstOrDefault()); }
protected IWebElement CurrencyFor(string currencyISO) => WrappedElement.FindElements(By.XPath($".//a[contains(., '{currencyISO}')]")).FirstOrDefault();
/// <summary> /// Returns a list of news items. /// </summary> /// <returns></returns> public virtual IReadOnlyList <NewsItem> NewsItems() { return(WrappedElement.FindElements(panelHeadingSelector) .Select(e => new NewsItem(e)) .ToList()); }