Created
July 4, 2012 16:13
-
-
Save stuartf7/3048097 to your computer and use it in GitHub Desktop.
Some More Selenium Tests
This file contains hidden or 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
[Test] | |
public void SearchForTest() | |
{ | |
IWebElement searchbox = _driver.FindElement(By.Name("q")); | |
searchbox.SendKeys("Test"); | |
searchbox.SendKeys(Keys.Enter); //send [enter] key to the control. | |
Assert.AreEqual("Test - Google Search", _driver.Title); | |
} | |
[Test] | |
public void SearchForTestAndFindResult() | |
{ | |
IWebElement searchbox = _driver.FindElement(By.Name("q")); | |
searchbox.SendKeys("test"); | |
searchbox.SendKeys(Keys.Enter); //send [enter] key to the control. | |
Assert.IsNotNull(_driver.FindElement(By.LinkText("Test Central"))); | |
} | |
[Test] | |
public void SearchForSelenium() | |
{ | |
IWebElement searchbox = _driver.FindElement(By.Name("q")); | |
searchbox.SendKeys("Selenium"); | |
searchbox.Submit(); //submits the form that the control is on. | |
Assert.AreEqual("Selenium - Google Search", _driver.Title); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment