Пример #1
0
 void Scroll(DinamicElement scrollEl, int x)
 {
     scrollEl.Interaction(el =>
     {
         var scrolabelBlock     = el.FindElement(By.TagName("ul"));
         IJavaScriptExecutor js = (IJavaScriptExecutor)Driver;
         js.ExecuteScript($"arguments[0].scrollBy(0, {x})", scrolabelBlock);
     });
 }
Пример #2
0
 public static DinamicElement GetDinamicElement(this IWebDriver driver, string XPathString)
 {
     while (true)
     {
         try
         {
             var el     = driver.FindElement(By.XPath(XPathString));
             var result = new DinamicElement(driver, XPathString);
             return(result);
         }
         catch (Exception)
         {
         }
     }
 }
Пример #3
0
        private DropdawnMenu(IWebDriver driver, string xpath)
            : base(driver, xpath)
        {
            Interaction((el) =>
            {
                handler = new DinamicElement(driver, $"{XPath}/{XPATH_HANDLER}");
            });

            Interaction((el) =>
            {
                chosenDrop = new DinamicElement(driver, $"{XPath}/{XPATH_CHOSEN_DROP}");
            });

            chosenContainer = FindeElement("//div[contains(@class, \"osen-container\")]");
        }
Пример #4
0
        List <DinamicElement> WaitLiItemsDownloads(DinamicElement liParent)
        {
            var items = liParent.FindeElements("//li");

            while (items.Count == 0)
            {
                items = liParent.FindeElements("//li");
            }

            //Waiting item list download
            items[0].Interaction((_) =>
            {
                while (_.Text.ToLower().Contains("выбрать") || (_.Text.ToLower().Contains("выберите") && items.Count == 1))
                {
                    Thread.Sleep(50);
                }
            });

            return(items);
        }