public ElementVerification(Element element, int timeoutSec, bool failTest = false, bool isTrue = true)
 {
     this.element = element;
     this.timeoutSec = timeoutSec;
     this.failTest = failTest;
     this.isTrue = isTrue;
 }
Exemplo n.º 2
0
 public void Test()
 {
     driver.Navigate().GoToUrl("http://www.espn.com");
     var element = new Element("ESPN Element", By.XPath("//*[@class='espn-logo']//*[text()='ESPN']"));
     element.WaitUntil(10).Visible();
     Common.Log("Successfully navigated to " + driver.Title);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Construct an element within an iframe
 /// </summary>
 /// <param name="name">Human readable name of the element</param>
 /// <param name="locator">By locator</param>
 public Element(string name, By locator, Element frame): base()
 {
     this._frame = frame;
     this.name = name;
     this.by = locator;
     this.pageObjectName = TestBase.GetCurrentClassName();
     this.timeoutSec = Config.Settings.runTimeSettings.ElementTimeoutSec;
 }
Exemplo n.º 4
0
 public void TestNotPresent()
 {
     driver.Navigate().GoToUrl("http://www.google.com/");
     var SearchField = new Element("SearchField", By.Name("q"));
     var element = new Element("NotPresentElement", By.Name("z"));
     SearchField.WaitUntil().Present();
     element.Verify().Not().Present();
 }
Exemplo n.º 5
0
 public void TestDSL()
 {
     driver.Navigate().GoToUrl("http://www.google.com/");
     var element = new Element("NameOfElement", By.Name("q"));
     element.SetText("ProtoTest");
     element.Verify().Value("ProtoTest").Submit();
     element.WaitUntil(20).Visible().Text = "Golem";
     element.Verify(20).Value("Golem");
 }
 public Element SearchResult(string text)
 {
     searchResult = new Element("SearchResultLink", By.PartialLinkText(text));
     return searchResult;
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Construct an element
 /// </summary>
 /// <param name="locator">By locator</param>
 public Element(By locator, Element frame)
 {
     _frame = frame;
     name = "Element";
     by = locator;
     pageObjectName = TestBase.GetCurrentClassName();
     timeoutSec = Config.Settings.runTimeSettings.ElementTimeoutSec;
 }
Exemplo n.º 8
0
 public ReadOnlyCollection<IWebElement> FindElements(Element element)
 {
     return FindElements(element.by);
 }
Exemplo n.º 9
0
 /// <summary>
 ///     Returns the first element found by the locator.
 /// </summary>
 /// <param name="by">The locator to use.</param>
 /// <returns>The IWebElement found.</returns>
 public IWebElement FindElement(Element childElement)
 {
     var then = DateTime.Now.AddSeconds(timeoutSec);
     for (var now = DateTime.Now; now < then; now = DateTime.Now)
     {
         try
         {
             var eles = element.FindElements(childElement.by);
             if (eles.Count > 0)
                 return new Element(eles[0], by);
             Common.Delay(1000);
         }
         catch (StaleElementReferenceException e)
         {
         }
     }
     throw new NoSuchElementException(string.Format("Element ({0}) was not present after {1} seconds",
         childElement.@by, timeoutSec));
 }
Exemplo n.º 10
0
 public void TestWithName()
 {
     var element = new Element("NameOfElement",By.Id("Id"));
     Assert.AreEqual(element.name, "NameOfElement");
 }
Exemplo n.º 11
0
 public void TestNoName()
 {
     var element = new Element(By.Id("Id"));
     Assert.AreEqual(element.name, "Element");
 }
Exemplo n.º 12
0
 public Component(Element RootElement, string name, By by) : base(name, by)
 {
     this.RootElement = RootElement;
 }
Exemplo n.º 13
0
 public Component(Element RootElement, By by) : base(by)
 {
     this.RootElement = RootElement;
 }