Is it possible to set up an assertion to verify value of a NUnit element?
Hi Ana,
To set up an assertion to verify value of a NUnit element, please refer and add the following codes below:
{
{
Console.WriteLine("Navigating to todos app.");
driver.Value.Navigate().GoToUrl("https://lambdatest.github.io/sample-todo-app/");
driver.Value.FindElement(By.Name("li4")).Click();
Console.WriteLine("Clicking Checkbox");
driver.Value.FindElement(By.Name("li5")).Click();
IList<IWebElement> elems = driver.Value.FindElements(By.ClassName("done-true"));
Assert.AreEqual(2, elems.Count);
Console.WriteLine("Entering Text");
driver.Value.FindElement(By.Id("sampletodotext")).SendKeys("Yey, Let's add it to list");
driver.Value.FindElement(By.Id("addbutton")).Click();
string spanText = driver.Value.FindElement(By.XPath("/html/body/div/div/div/ul/li[6]/span")).Text;
Assert.AreEqual("Yey, Let's add it to list", spanText);
}
}