Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- namespace _01
- {
- [TestClass]
- public class SeleniumLiveDemo
- {
- private IWebDriver Driver;
- [TestInitialize]
- public void OpenBrowser()
- {
- this.Driver = new ChromeDriver();
- }
- [TestMethod]
- public void TestMethod1()
- {
- this.Driver.Navigate().GoToUrl("http://demoqa.com/registration/");
- string firstName = Faker.Name.First();
- string lastName = Faker.Name.Last();
- string email = Faker.Internet.Email();
- var firstNameTextBox = Driver.FindElement(By.Id("name_3_firstname"));
- firstNameTextBox.SendKeys(firstName);
- var lastNameTextBox = Driver.FindElement(By.Id("name_3_lastname"));
- lastNameTextBox.SendKeys(lastName);
- var emailTextBox = Driver.FindElement(By.Id("email_1"));
- emailTextBox.SendKeys(email);
- var registrationButton = Driver.FindElement(By.Id("menu-item-374"));
- string registrationbuttonText = registrationButton.Text;
- Assert.AreEqual("Registration", registrationbuttonText);
- Thread.Sleep(3000);
- }
- [TestCleanup]
- public void CloseBrowser()
- {
- this.Driver.Close();
- }
- }
- }
Add Comment
Please, Sign In to add comment