public IWebElement Find(IWindowProperty property, ISearchContext subElement = null) { if (subElement == null) { subElement = driver; } switch (property.SearchType) { case WindowPropertySearchType.Id: return(subElement.FindElement(By.Id(property.Pattern))); case WindowPropertySearchType.Name: return(subElement.FindElement(By.Name(property.Pattern))); case WindowPropertySearchType.Class: return(subElement.FindElement(By.ClassName(property.Pattern))); case WindowPropertySearchType.Selector: return(subElement.FindElement(By.CssSelector(property.Pattern))); default: throw new NotFoundException("Search doesn't have type property"); } }
public void Click(IWindowProperty property) { var element = Find(property); var jse = (IJavaScriptExecutor)driver; jse.ExecuteScript("arguments[0].scrollIntoView()", element); element.Click(); }
public void SelectNextPage(IWindowProperty paginationProperty) { var paginationArea = Find(paginationProperty); var paginationButtons = new WindowProperty() { Pattern = "a", SearchType = WindowPropertySearchType.Selector }; FindAll(paginationButtons, paginationArea).Last().Click(); }
public bool Has(IWindowProperty property, ISearchContext subElement = null) { var items = FindAll(property, subElement); return(items.Count() > 0); }
public IEnumerable <String> GetTexts(IWindowProperty property) { return(FindAll(property).Select(i => i.Text)); }
public string GetText(IWindowProperty property) { return(Find(property).Text); }
public void Select(IWindowProperty property, String selectText) { new SelectElement(Find(property)).SelectByText(selectText); }
public void WriteTo(IWindowProperty property, String message) { Find(property).SendKeys(message); }
public void GoTo(IWindowProperty property) { driver.Navigate().GoToUrl(property.Pattern); }
public void WriteWindowProperty(IWindowProperty windowProperty) { this.WriteShort(windowProperty.Property); this.WriteShort(windowProperty.Value); }