Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        public void Click(IWindowProperty property)
        {
            var element = Find(property);

            var jse = (IJavaScriptExecutor)driver;

            jse.ExecuteScript("arguments[0].scrollIntoView()", element);

            element.Click();
        }
Exemplo n.º 3
0
        public void SelectNextPage(IWindowProperty paginationProperty)
        {
            var paginationArea = Find(paginationProperty);

            var paginationButtons = new WindowProperty()
            {
                Pattern = "a", SearchType = WindowPropertySearchType.Selector
            };

            FindAll(paginationButtons, paginationArea).Last().Click();
        }
Exemplo n.º 4
0
        public bool Has(IWindowProperty property, ISearchContext subElement = null)
        {
            var items = FindAll(property, subElement);

            return(items.Count() > 0);
        }
Exemplo n.º 5
0
 public IEnumerable <String> GetTexts(IWindowProperty property)
 {
     return(FindAll(property).Select(i => i.Text));
 }
Exemplo n.º 6
0
 public string GetText(IWindowProperty property)
 {
     return(Find(property).Text);
 }
Exemplo n.º 7
0
 public void Select(IWindowProperty property, String selectText)
 {
     new SelectElement(Find(property)).SelectByText(selectText);
 }
Exemplo n.º 8
0
 public void WriteTo(IWindowProperty property, String message)
 {
     Find(property).SendKeys(message);
 }
Exemplo n.º 9
0
 public void GoTo(IWindowProperty property)
 {
     driver.Navigate().GoToUrl(property.Pattern);
 }
Exemplo n.º 10
0
 public void WriteWindowProperty(IWindowProperty windowProperty)
 {
     this.WriteShort(windowProperty.Property);
     this.WriteShort(windowProperty.Value);
 }