Пример #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");
            }
        }
Пример #2
0
        public void Click(IWindowProperty property)
        {
            var element = Find(property);

            var jse = (IJavaScriptExecutor)driver;

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

            element.Click();
        }
Пример #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();
        }
Пример #4
0
        public bool Has(IWindowProperty property, ISearchContext subElement = null)
        {
            var items = FindAll(property, subElement);

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