Exemple #1
0
 public Tree(SeleniumElement parent, TreeElement tree, [CallerMemberName] string?toStringValue = null) :
     base(parent, By.XPath(".//div[@class[contains(.,\"tree\")]]/ul/li"), toStringValue)
 {
     if (tree == null)
     {
         throw new ArgumentNullException(nameof(tree));
     }
     Branches = tree.Branches.Select((x, i) => new Branch(this, x, ++i, $"{x} Branch")).ToList();
 }
Exemple #2
0
        public static void Wait(SeleniumElement element, int timeout)
        {
            int seconds = 0;

            while (!element.Exists())
            {
                Thread.Sleep(1000);
                seconds++;
                if (seconds > timeout)
                {
                    throw new PageLoadTimeoutException("Page Load Timeout.");
                }
            }
        }
        public void Click(bool forceJavascriptClick)
        {
            try
            {
                if (SeleniumElement.Displayed && !forceJavascriptClick)
                {
                    SeleniumElement.Click();
                }
                else
                {
                    this.TriggerJavascriptClick();
                }
            }
            catch (ElementNotVisibleException)
            {
                this.TriggerJavascriptClick();
            }
            catch (InvalidOperationException)
            {
                try
                {
                    this.TriggerJavascriptClick();
                }
                catch
                {
                    TimeSpan timeOut = GlobalConfiguration.Configuration.WaitTimeout;

                    TimeoutManager.Execute(timeOut, item =>
                    {
                        try
                        {
                            item.Click();
                            return(true);
                        }
                        catch (InvalidOperationException)
                        {
                            return(false);
                        }
                    }, this);
                }
            }
        }
 internal VectorTable(SeleniumElement parent, int vector) :
     base(parent, By.XPath($".//table[@id=\"vector {vector}\"]"))
 {
 }
 public string GetCssValue(string propertyName)
 {
     return(SeleniumElement.GetCssValue(propertyName));
 }
 public string GetAttribute(string attributeName)
 {
     return(SeleniumElement.GetAttribute(attributeName));
 }
 public void Submit()
 {
     SeleniumElement.Submit();
 }
 public void SendKeys(string text)
 {
     SeleniumElement.SendKeys(text);
 }
 public void Clear()
 {
     SeleniumElement.Clear();
 }
 public override ReadOnlyCollection <IWebElement> FindElements(By @by)
 {
     return(SeleniumElement.FindElements(@by));
 }
 public override IWebElement FindElement(By @by)
 {
     return(SeleniumElement.FindElement(@by));
 }
 public string GetProperty(string propertyName)
 {
     return(SeleniumElement.GetProperty(propertyName));
 }
Exemple #13
0
 public virtual void SetText(string text)
 {
     SeleniumElement.SendKeys(text);
 }
Exemple #14
0
 public virtual void Click()
 {
     // реализовать нажатие на элемент
     SeleniumElement.Click();
 }
Exemple #15
0
 public Table(SeleniumElement parent, By by)
     : base(parent, by)
 {
 }
Exemple #16
0
 public Branch(SeleniumElement parent, Models.TreeElement tree, int index = 1, [CallerMemberName] string?toStringValue = null) :
     base(parent, CalculateBy(tree, index), toStringValue)
 {
     ChildBranches = tree.Branches.Select((x, i) => new Branch(this, x, ++i, x.ToString())).ToList();
 }