Checking if an H2 element contains specific text

I have created a simple test which opened browser, navigated to url, keyed in a search value of 123456789123456 and checked the page navigated to has an H2 element with the text “No Details for Device with IMEI Number 123456789123456 found”. This works fine. I now have introduced a variable IMEINumber which is linked to an internal Data File of 5 IMEINumbers I have successfully altered the Set Text step to utilise the variable but struggling with the Verify Element Text step.

My Step values are:

Item                   Object  Input
Verify Element Text    H2      "No Details for Device with IMEI Number " + ${IMEINumber} + " found"

How do I incorporate the variable into the string. Or is there a way to just test that the H2 element contains the value of variable IMEINumber. Any help apreciated

When you use the dollar sign and curly brackets around your variable, you can enclose it within the double quotes, like below:

2 Likes

Alternatively, you can do without the dollar sign and curly brackets, like:

Item                   Object  Input
Verify Element Text    H2      "No Details for Device with IMEI Number " + IMEINumber + " found"

Thank you @grylion54 for great help!!!