Created
April 18, 2016 00:02
-
-
Save nadvolod/22622da95e405d38482ccf345eb9f479 to your computer and use it in GitHub Desktop.
Simple automated functional test that attempts to interact with an element that does not yet exist on the page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UnitTest1 | |
{ | |
private IWebDriver _driver; | |
[TestInitialize] | |
public void Setup() | |
{ | |
//LocalInitialize(); | |
BasicInitialize(); | |
} | |
private void BasicInitialize() | |
{ | |
_driver = new FirefoxDriver(); | |
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1)); | |
} | |
[TestCleanup] | |
public void Teardown() | |
{ | |
_driver.Close(); | |
_driver.Quit(); | |
} | |
[TestMethod] | |
public void DynamicallyLoadingElementsTestFailure() | |
{ | |
//go to a url that contains a dynamically loading page element | |
_driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/dynamic_loading/1"); | |
//click the start button | |
_driver.FindElement(By.Id("start")).Click(); | |
//find the element that has the text Hello World | |
var text = _driver.FindElement(By.XPath(".//*[contains(text(),'Hello World!')]")); | |
//click on the text | |
text.Click(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment