Ios Automation: cannot find text with carriage return


my iOS application has some labels containing carriage return characters (’\n’).
So far, I’m unable to find these labels using the iOS predicates:

This label (with its carriage return) is visible in the page source (between ‘the’ and ‘Terms and conditions’):

If I try to use this text in a predicate, I get an EOF error (because there is a carriage return in the query). I tried replacing the ‘\n’ with ‘%0D’ (url encoding for ‘\n’) or with ‘\n’ (escaping the ‘\n’), with no luck.

Has anyone already dealt with this issue ?
Thanks for your help !

ok, found the solution finally.
The ‘\n’ needed to be escaped several times as I’m using the Java client.

So my predicate is “By continuing, you accept the\\\\nTerms and conditions.” (4 ‘’) as Java will reduce this to 2, and then JS will treat it as 1.

1 Like