Guest User

Untitled

a guest
Nov 21st, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. [Test]
  2. public void SearchForTest()
  3. {
  4. IWebElement searchbox = _driver.FindElement(By.Name("q"));
  5.  
  6. searchbox.SendKeys("Test");
  7. searchbox.SendKeys(Keys.Enter); //send [enter] key to the control.
  8.  
  9. Assert.AreEqual("Test - Google Search", _driver.Title);
  10. }
  11.  
  12. [Test]
  13. public void SearchForTestAndFindResult()
  14. {
  15. IWebElement searchbox = _driver.FindElement(By.Name("q"));
  16.  
  17. searchbox.SendKeys("test");
  18. searchbox.SendKeys(Keys.Enter); //send [enter] key to the control.
  19.  
  20. Assert.IsNotNull(_driver.FindElement(By.LinkText("Test Central")));
  21. }
  22.  
  23. [Test]
  24. public void SearchForSelenium()
  25. {
  26. IWebElement searchbox = _driver.FindElement(By.Name("q"));
  27.  
  28. searchbox.SendKeys("Selenium");
  29. searchbox.Submit(); //submits the form that the control is on.
  30.  
  31. Assert.AreEqual("Selenium - Google Search", _driver.Title);
  32. }
Add Comment
Please, Sign In to add comment