public void NewFindDifferentThanCached() { // Create the lazy element and use it LazyElement footer = new LazyElement(this.TestObject, By.CssSelector("FOOTER P"), "Footer"); // Trigger a find and save off the element footer.GetValue(); IWebElement footerElementBefore = footer.CachedElement; // Do the event again and save off the changed element footer.GetValue(); // Make sure doing a new find returns an element that is not the same as the cached element Assert.AreNotEqual(WebDriver.FindElement(footer.By), footerElementBefore); }
public void LazyElementCached() { // Create the lazy element and use it LazyElement footer = new LazyElement(this.TestObject, By.CssSelector("FOOTER P"), "Footer"); // Trigger a find and save off the element footer.GetValue(); IWebElement footerElementBefore = footer.CachedElement; // Do the event again and save off the changed element footer.GetValue(); IWebElement footerElementAfter = footer.CachedElement; // Make sure the second event didn't trigger a new find Assert.AreEqual(footerElementBefore, footerElementAfter); }
public void LazyElementSendKeysWithInteractionNavComplex() { WebDriver.Navigate().GoToUrl("https://www.google.com/"); LazyElement lazyRoot = new LazyElement(this.TestObject, By.Name("q")); lazyRoot.SendKeys("SEARCH" + Keys.Tab + "TXT"); Assert.AreEqual("SEARCH", lazyRoot.GetValue()); }
public void LazyCaching() { // Create the lazy element and use it LazyElement footer = new LazyElement(this.TestObject, By.CssSelector("FOOTER P"), "Footer"); // Trigger a find and save off the element footer.GetValue(); IWebElement footerElementBefore = footer.CachedElement; // Do the event again and save off the changed element footer.GetValue(); // Go to another page so the old element will be stale, this will force us to get a new one WebDriver.Navigate().GoToUrl(SeleniumConfig.GetWebSiteBase() + "Automation/AsyncPage"); // Trigger a new find, this should be new because the cached element is stale footer.GetValue(); Assert.AreNotEqual(footerElementBefore, footer.CachedElement); }