can testcase from recorder search wpf element only by automation id?

Ranorex Studio, Spy, Recorder, and Driver.
yangz
Posts: 4
Joined: Wed Feb 08, 2023 12:46 pm

can testcase from recorder search wpf element only by automation id?

Post by yangz » Fri Apr 28, 2023 12:58 pm

Ranorex version 10.5.3

Can test case from recorder search wpf element only by “AutomationProperties.AutomationId“ in WPF as Ranroex API?

Example:

1 User create testcase with recorder

2 user edit xpath of wpf element from recorder testcase

example1:
change xpath from "?/?/tabpage[@automationid='JTab']" to "tabpage[@automationid='JTab']"

example2:
change xpath from ".//tabpage[@name='New']//element[@automationid='Create']//list[@automationid='Task']/listitem[5]/button[@automationid='M']"

to "button[@automationid='M']"

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: can testcase from recorder search wpf element only by automation id?

Post by doke » Mon May 01, 2023 10:08 am

Hi,

yes you can change it to ".//button[@automationid='M']"

But this has several implications:
- perfomance wise ranorex has to iterate through all items to find elements which meet this xpath. which takes more time.
- More elements might be found which match with this xpath. this could result into wrong element being used by ranorex.

Good luck,

Don

DomantasK
Posts: 12
Joined: Mon Mar 06, 2023 11:18 am

Re: can testcase from recorder search wpf element only by automation id?

Post by DomantasK » Mon May 08, 2023 10:16 am

Yes, we're working with the same approach on our current project where AutomationIDs are present, performance wise we did not experience much difference even if it's iterating through all descendants.