Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using NUnit.Framework;
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- using OpenQA.Selenium.Support.UI;
- using System;
- using System.IO;
- using System.Reflection;
- namespace SeleniumBasic
- {
- [TestFixture]
- class RegistrationTests
- {
- private IWebDriver _driver;
- private WebDriverWait _wait;
- [SetUp]
- public void SetUp()
- {
- _driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
- _driver.Url = "http://automationpractice.com/index.php";
- _wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(2));
- }
- [TearDown]
- public void TearDown()
- {
- _driver.Quit();
- }
- [Test]
- public void OpenTheNavigationBar()
- {
- IWebElement signInButton = _driver.FindElement(By.XPath("/html/body/div/div[1]/header/div[2]/div/div/nav/div[1]/a"));
- signInButton.Click();
- IWebElement createSection =
- _wait.Until<IWebElement>(c => c.FindElement(By.CssSelector("#email_create")));
- createSection.SendKeys(Keys.Enter);
- IWebElement emailInformationField =
- _wait.Until<IWebElement>(e => e.FindElement(By.XPath("html/body/div/div[2]/div/div[3]/div/div/form/div[1]/div[4]/input")));
- Assert.AreEqual(expectedMail, emailInformationField.GetAttribute("value"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment