Beispiel #1
0
 internal FillInWith(ElementScope element, IDriver driver, TimingStrategy timingStrategy, Options options)
 {
     this.element        = element;
     this.driver         = driver;
     this.timingStrategy = timingStrategy;
     this.options        = options;
 }
Beispiel #2
0
 internal FillInWith(ElementScope element, Driver driver, TimingStrategy timingStrategy, Options options)
 {
     this.element = element;
     this.driver = driver;
     this.timingStrategy = timingStrategy;
     this.options = options;
 }
Beispiel #3
0
 public static void WaitForAvailability(this ElementScope element)
 {
     while (element.Disabled)
     {
         System.Threading.Thread.Sleep(100);
     }
 }
 public void AAndBLineUp(ElementScope field, ElementScope field2)
 {
     string One = field["offsetTop"];
     string Two = field2["offsetTop"];
     int one = int.Parse(One);
     int two = int.Parse(Two);
     Assert.AreEqual(one, two);
 }
Beispiel #5
0
        public void Init()
        {
            ElementScope table = scope.FindXPath(locators[0]);

            // body
            var tbody = table.FindXPath(".//tbody");

            RowsOfElements = new List <List <ElementScope> >();
            foreach (var tr in tbody.FindAllXPath(".//tr"))
            {
                var row = new List <ElementScope>();
                RowsOfElements.Add(row);
                foreach (var td in tr.FindAllXPath(".//td"))
                {
                    row.Add(td);
                }
            }

            // head
            if (isHeader)
            {
                ElementScope theader;
                IEnumerable <ElementScope> headerLines;
                try
                {
                    theader     = table.FindAllXPath(".//thead").First();
                    headerLines = (IEnumerable <ElementScope>)theader.FindAllXPath(".//tr");
                }
                catch (NoSuchElementException)
                {
                    theader     = table;
                    headerLines = new ElementScope[] { theader.FindAllXPath(".//tr").First() };
                    RowsOfElements.RemoveAt(0);
                }

                Header         = new List <ElementScope>();
                HeaderCaptions = new List <string>();
                foreach (var tr in headerLines)
                {
                    var cells = tr.FindAllXPath(".//th");
                    if (cells.Count() > 0)
                    {
                        if (Header.Count > 0)
                        {
                            throw new Exception(
                                      $"Too many headers in the table {locators[0]}. Contents: {theader.Text}");
                        }

                        foreach (var td in cells)
                        {
                            Header.Add(td);
                            HeaderCaptions.Add(td.Text);
                        }
                    }
                }
            }
        }
 public void ABeforeB(ElementScope field, ElementScope field2)
 {
     string One = field["offsetTop"];
     string Two = field2["offsetTop"];
     int one = int.Parse(One);
     int two = int.Parse(Two);
     int result = (two - one);
     Assert.Less(one, two);
 }
Beispiel #7
0
        public FieldAutocomplete(ElementScope field, string listXPath, string elementsXPath, Options options = null)
        {
            _element           = field;
            this.listXPath     = listXPath;
            this.elementsXPath = elementsXPath;
            this.options       = Merge(options);

            SetScope(field.OuterScope);
            SetFinder(field.elementFinder);
        }
Beispiel #8
0
 public static void WaitForClickability(this ElementScope element)
 {
     while (true)
     {
         try
         {
             element.Click();
             return;
         }
         catch (Exception)
         {
             Debug.WriteLine("Элемент заблокирован. Пытаемся кликнуть...");
         }
     }
 }
Beispiel #9
0
 public static void WaitForVisibility(this ElementScope element)
 {
     while (true)
     {
         try
         {
             element.Hover(new Options {
                 WaitBeforeClick = System.TimeSpan.FromMilliseconds(350)
             });
             return;
         }
         catch (Exception)
         {
         }
     }
 }
Beispiel #10
0
        public bool longClickElement(Coypu.ElementScope clickThis, int waitSeconds = 30, int retrySeconds = 5)
        {
            DateTime quitTime = DateTime.Now.AddSeconds(waitSeconds);

            while (DateTime.Now <= quitTime)
            {
                try
                {
                    clickThis.Click();
                    clickThis.Now();
                }
                catch (Exception)
                {
                    System.Threading.Thread.Sleep(retrySeconds * 1000);
                }
            }
            return(false);
        }
Beispiel #11
0
        public static void FillDropDownWith(this ElementScope dropdown, string option, Options coypuOptions = null) //  метод ищет в выпадающем списке все значения, содержащие город и берет из них первый
        {
            if (coypuOptions == null)
            {
                coypuOptions = new Options()
                {
                    TextPrecision = TextPrecision.Exact, ConsiderInvisibleElements = false
                }
            }
            ;
            //var optionToSelect = dropdown.FindXPath($".//li[.='{option}']");
            Thread.Sleep(900);
            var optionsToSelect = dropdown.FindAllXPath($".//li[contains(.,'{option}')]");
            var optionToSelect  = optionsToSelect.First(f => f.Text == option);

            optionToSelect.Hover();
            Thread.Sleep(200);
            optionToSelect.Click(coypuOptions);
        }
Beispiel #12
0
        public static void CheckListElementExist(this ElementScope dropdown, string option, Options coypuOptions = null)     // метод проверяет существует ли в списке город
        {
            if (coypuOptions == null)
            {
                coypuOptions = new Options()
                {
                    TextPrecision = TextPrecision.Exact, ConsiderInvisibleElements = false
                }
            }
            ;
            //var optionToSelect = dropdown.FindXPath($".//li[.='{option}']");
            Thread.Sleep(900);

            //var optionsToSelect = dropdown.FindAllXPath($".//li[contains(.,'{option}')]");
            var optionsToSelect = dropdown.FindXPath($"//li[.='{option}']");

            optionsToSelect.Hover();
            Thread.Sleep(200);
            optionsToSelect.Click(coypuOptions);
        }
Beispiel #13
0
 public bool Has(ElementScope findElement)
 {
     return(findElement.Exists());
 }
Beispiel #14
0
 public void Uncheck(ElementScope checkbox, Options options = null)
 {
     throw new NotImplementedException();
 }
 public TableRowGroupElementScope(ElementScope innerElement)
     : base(innerElement)
 {
 }
 public TableElementScope(ElementScope elementScope)
     : base(elementScope)
 {
 }
Beispiel #17
0
 internal FillInWith(ElementScope element, Driver driver, RobustWrapper robustWrapper, DriverScope scope, Options options)
     : this(element.Now(),driver,robustWrapper,scope,options)
 {
 }
Beispiel #18
0
 /// <summary>
 /// Fill in a previously found text field
 /// </summary>
 /// <param name="element">The text field</param>
 /// <returns>With</returns>
 public FillInWith FillIn(ElementScope element, Options options = null)
 {
     return new FillInWith(element, driver, robustWrapper, this, SetOptions(options));
 }
Beispiel #19
0
 internal FillInWith(ElementScope element, Driver driver, RobustWrapper robustWrapper, DriverScope scope, Options options)
     : this(element.Now(), driver, robustWrapper, scope, options)
 {
 }
 private static Point GetTotemCoordinates(ElementScope imgTag)
 {
     var native = imgTag.Native;
       if (native is OpenQA.Selenium.Remote.RemoteWebElement)
     return ((OpenQA.Selenium.Remote.RemoteWebElement)native).Coordinates.LocationInDom;
       throw new MonopolyTestRunException("Test infrastructure problem: can't figure out what browser we're using to get the native coordinates. Find this method and add browser-specific code to fix this problem.");
 }
Beispiel #21
0
 public bool HasNo(ElementScope findElement)
 {
     return(findElement.Missing());
 }
Beispiel #22
0
 public static string GetSrcFilenameFrom(ElementScope playerTotemImgTag)
 {
     return playerTotemImgTag["src"].Split('/').Last();
 }
Beispiel #23
0
 public FieldAutocomplete FindFieldAutocomplete(ElementScope field, string listXPath, string elementsXPath, Options options = null)
 {
     return(session.FindFieldAutocomplete(field, listXPath, elementsXPath, Merge(options)));
 }
 private void AssertEvent(ElementScope row, TestEvent e)
 {
     Assert.AreEqual(e.Name, row.FindCss("a").Text);
     Assert.AreEqual(e.StartDate, row.FindCss("small").Text);
 }
Beispiel #25
0
 /// <summary>
 /// Fill in a previously found text field
 /// </summary>
 /// <param name="element">The text field</param>
 /// <returns>With</returns>
 public FillInWith FillIn(ElementScope element, Options options = null)
 {
     return(new FillInWith(element, driver, robustWrapper, this, SetOptions(options)));
 }
Beispiel #26
0
 public TableAttribute(string locator, ElementScope e = null)
 {
     this.locator = locator;
     this.element = e;
 }