public ElementVerification(Element element, int timeoutSec, bool failTest = false, bool isTrue = true) { this.element = element; this.timeoutSec = timeoutSec; this.failTest = failTest; this.isTrue = isTrue; }
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); }
/// <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; }
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(); }
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; }
/// <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; }
public ReadOnlyCollection<IWebElement> FindElements(Element element) { return FindElements(element.by); }
/// <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)); }
public void TestWithName() { var element = new Element("NameOfElement",By.Id("Id")); Assert.AreEqual(element.name, "NameOfElement"); }
public void TestNoName() { var element = new Element(By.Id("Id")); Assert.AreEqual(element.name, "Element"); }
public Component(Element RootElement, string name, By by) : base(name, by) { this.RootElement = RootElement; }
public Component(Element RootElement, By by) : base(by) { this.RootElement = RootElement; }