Steps:
1. Find the element with locators and store with webElement Type.
2. Create two string variable like below program.
3. string ExpText - store the expected string value.
4. string ActText - Get runtime string value.
5. Use assert and verify the expected Value with Actual value.
Ex
public void VerifyTexPresentOrNot()
{
IWebElement PrizeStoreText = driver.FindElementByXPath("//*[@class ='android.view.View' and @index='0']");
string ExpText = "POINTS REDEMPTION REMINDER:";
string ActText = PrizeStoreText.Text;
if (ExpText.Equals(ActText))
{
Assert.AreEqual(ExpText, ActText);
Console.WriteLine("Text verified Successfully");
}
else
{
Console.WriteLine("Text Verification Failed");
}
1. Find the element with locators and store with webElement Type.
2. Create two string variable like below program.
3. string ExpText - store the expected string value.
4. string ActText - Get runtime string value.
5. Use assert and verify the expected Value with Actual value.
Ex
public void VerifyTexPresentOrNot()
{
IWebElement PrizeStoreText = driver.FindElementByXPath("//*[@class ='android.view.View' and @index='0']");
string ExpText = "POINTS REDEMPTION REMINDER:";
string ActText = PrizeStoreText.Text;
if (ExpText.Equals(ActText))
{
Assert.AreEqual(ExpText, ActText);
Console.WriteLine("Text verified Successfully");
}
else
{
Console.WriteLine("Text Verification Failed");
}