How can I set up an assertion to verify value of an MSTest element?
Hi Ana,
To set up an assertion, please add the following sample codes below:
Assert.AreEqual("Sample page - lambdatest.com", driver.Title);
IWebElement firstCheckBox = driver.FindElement(By.Name("li1"));
firstCheckBox.Click();
IWebElement secondCheckBox = driver.FindElement(By.Name("li2"));
secondCheckBox.Click();
IWebElement textfield = driver.FindElement(By.Id("sampletodotext"));
textfield.SendKeys(itemName);
IWebElement addButton = driver.FindElement(By.Id("addbutton"));
addButton.Click();
IWebElement itemtext = driver.FindElement(By.XPath("/html/body/div/div/div/ul/li[6]/span"));
String getText = itemtext.Text;
Assert.IsTrue(itemName.Contains(getText));