penkafileva

QA

Oct 25th, 2017
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using Microsoft.VisualStudio.TestTools.UnitTesting;
  4. using OpenQA.Selenium;
  5. using OpenQA.Selenium.Chrome;
  6.  
  7. namespace _01
  8. {
  9. [TestClass]
  10. public class SeleniumLiveDemo
  11. {
  12. private IWebDriver Driver;
  13.  
  14. [TestInitialize]
  15. public void OpenBrowser()
  16. {
  17. this.Driver = new ChromeDriver();
  18. }
  19.  
  20. [TestMethod]
  21. public void TestMethod1()
  22. {
  23. this.Driver.Navigate().GoToUrl("http://demoqa.com/registration/");
  24. string firstName = Faker.Name.First();
  25. string lastName = Faker.Name.Last();
  26. string email = Faker.Internet.Email();
  27.  
  28. var firstNameTextBox = Driver.FindElement(By.Id("name_3_firstname"));
  29. firstNameTextBox.SendKeys(firstName);
  30. var lastNameTextBox = Driver.FindElement(By.Id("name_3_lastname"));
  31. lastNameTextBox.SendKeys(lastName);
  32. var emailTextBox = Driver.FindElement(By.Id("email_1"));
  33. emailTextBox.SendKeys(email);
  34.  
  35.  
  36. var registrationButton = Driver.FindElement(By.Id("menu-item-374"));
  37. string registrationbuttonText = registrationButton.Text;
  38. Assert.AreEqual("Registration", registrationbuttonText);
  39.  
  40. Thread.Sleep(3000);
  41. }
  42.  
  43. [TestCleanup]
  44. public void CloseBrowser()
  45. {
  46. this.Driver.Close();
  47. }
  48. }
  49. }
Add Comment
Please, Sign In to add comment