Last active
September 15, 2022 10:55
-
-
Save SarahElson/40b7f87a73a3652d7b87820a2bb1ff85 to your computer and use it in GitHub Desktop.
Selenium C# test
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
using NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
namespace SeleniumTutorial | |
{ | |
public class SeleniumTests | |
{ | |
private IWebDriver driver; | |
[SetUp] | |
public void Setup() | |
{ | |
driver = new ChromeDriver(); | |
} | |
[Test] | |
public void ValidateTheMessageIsDisplayed() | |
{ | |
driver.Navigate().GoToUrl("https://www.lambdatest.com/selenium-playground/simple-form-demo"); | |
driver.FindElement(By.Id("user-message")).SendKeys("LambdaTest rules"); | |
driver.FindElement(By.Id("showInput")).Click(); | |
Assert.IsTrue(driver.FindElement(By.Id("message")).Text.Equals("LambdaTest rules"), "The expected message was not displayed."); | |
} | |
[TearDown] | |
public void TearDown() | |
{ | |
driver.Quit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment