How to check if a text is in web page in Robot Framework and Selenium How to check if a text is in web page in Robot Framework and Selenium selenium selenium

How to check if a text is in web page in Robot Framework and Selenium


You can easily do this with a built-in Selenium2Library tags.

For a partial match use this:

Element Should Contain    locator    expected_text

For an exact match use this:

Element Text Should Be    locator    expected_text


If your HTML code is something like:Your div tag and need to find FindMe

<div class="gwt-Label">This FindMe DIV</div>

Then you can find "FindMe" text like:

//div[@class='gwt-Label'][contains(string(),'FindMe')]