Searching for restricted characters

I had a requirement to search for a ] character but can find nothing in the manual about how to do it. Anyone done this before and can share with me how to do it?

Capture an image of the character and use something like this:
assert that imagefound(image:“MyCharacter”, waitfor:3)

You could also use OCR if you had to, but only do it if you must, like if your character changes.
assert that imagefound(text:"]",waitfor:3)

Consider adding a search rectangle to your image or text properties as well.

Thirdly, if your app is browser based you can use the built in “find” feature.
typetext controlkey, “f”
typetext “]”, returnkey
assert that imagefound(image:“capture_of_search_result”,waitfor:3)

Thanks LoganC. I have to use OCR with the SUT I have so I think the third method might just be the way to go! Thanks very much!

Not sure if this helps, but text in between quotes is not taken literally and eggplant may try to interpret special characters like the ]. I don’t know if you can escape sequence “]” like you can do “\’” — single quote character; “\” — backslash character.

Text between the double << >> it taken literally so using <<]>> in place of “]” should work.

Hi J_Grosso, yes that helps a lot. Many thanks!

Actually, quoted text in SenseTalk is literal. There is no difference between "]" and <<]>>. Escape sequences only apply when a string is preceded by “@” , like this: @"Line 1\nLine 2".

1 Like