简体   繁体   中英

Test that Verifies Element Text H2 equals "some text " + ${variable}

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

Schoolboy error... anything in ${} can be included in the text as long as you use back ticks... so the fix is:

`No Details for Device with IMEI Number ${IMEINumber} found`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM