I am trying to find a set of iOS UI elements in my automation script.
The framework is written in JS and utilizes Appium & WebdriverIO.
I was able to determine that the correct regex pattern I am searching for is this:
[- ][\d]{1,3}
which finds a string that starts with either /- and is of 3 numerical digits in length.
The current implementation I use is:
var strings = await $$("XCUIElementTypeStaticText[name*='[\d]{3}]']");
but I do not believe that is correct because when I print out the array length in console, it does not match to what is displayed in the iOS client UI.
Is it possible to use regex pattern matching when trying to find mobile application UI elements via CSS selector?
CodePudding user response:
It is not possible to use regex as part of the css expression. If possible please try adding testIdentifiers to those elements or use XCUITest predicates as suggested here