robotframework-flaui icon indicating copy to clipboard operation
robotframework-flaui copied to clipboard

Is there any way we can use starts-with or contains in Xpath for @AutomationId

Open Muthuvenaktesh opened this issue 2 years ago • 3 comments

can we use starts-with or contains in Xpath for @AutomationId, currently it works with @Name

Muthuvenaktesh avatar Feb 20 '23 12:02 Muthuvenaktesh

valid example //Button[@AutomationId='this is the id' and contains(@Name, 'this the name')] //Button[contains(., 'this the name or the id')]

Invalid unless the robot has admin privilages for some apps (maybe). Otherwise it should also work fine //Button[contains(@AutomationId, 'thisistheid' )]

noubar avatar Feb 21 '23 18:02 noubar

@noubar @Nepitwin

Thanks I am able to find the xpath with //Button[contains(., 'this the name or the id')].

Is there any we can loop through the elements, If more elements are found for the above condition.

I want to validate whether the first occurrence of the Id has specific parameters and second has different parameters.

Tried using //Button[contains(., 'this the name or the id')][2 or 3] it didn't work, it was able to find the first occurrence only.

Muthuvenaktesh avatar Mar 16 '23 12:03 Muthuvenaktesh

Currently we support only first occurence. Which should be enough because usually in app (gui under test) side, if it is ui automation friendly. It should always support unique automationid or name for specific element. Thus the element will have an unique xpath which can not occure more than once.

noubar avatar Mar 25 '23 16:03 noubar