How to set up an assertion to verify value of an element in pytest?

How can you set up an assertion to verify value of an element?

Hello Charity,

To set up an assertion to verify value of an element in pytest, please add the following sample code 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));