vendredi 31 juillet 2015

iOS UiAutomation - Predicate with Single Quote in String

I'm currently using iOS UIAutomation and identifying elements with a string generated from an external database that is populated with dynamic data. But iOS uiautomation throws a parser error when the string predicate contains a single quote.

Example: "UIATarget.localTarget().frontMostApp().mainWindow().collectionViews().firstWithPredicate(\"ANY visibleCells.name CONTAINS '" + title + "'")"

Note that if title = "Todds Apartment" this locator works fine. But if the string contains a single quote it throws the parser error. So for example if title = "Todd's Apartment" this wouldn't work.

Is there a way for the predicate evaluation within single quotes to contain a single quote?

Aucun commentaire:

Enregistrer un commentaire