stringsearcheggplant

Eggplant ImageFound([text]) not able to find string with apostrophe '


I have this string 'LOAD' button in my SUT, then I am trying to find if this text exist in the script using the command ImageFound(text:"'LOAD' button) but it always return me false. I am able to find the word LOAD itself but when I add the apostrophe around it, the result is not right.


Solution

  • If the string LOAD is unique in the SUT when you need need to interact with it then there is no reason to search for the complete string 'LOAD' button. You can, with some level of confidence, infer from existence of the string LOAD, a substring of your target, that your target string actually exists.

    With the exception of data, it's generally not good practice to assert on the contents of the text of the UI. Any static string can be validated before the UI is rendered, in unit tests, or some other, more lightweight, test regime than Eggplant.