Search control base on caption

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Search control base on caption

Post by eric.franc » Tue May 05, 2015 11:34 am

Hello,

I am currently evaluating ranorex, I have an issue that I have a pane that is created dynamically and the control ID are always different.

I would like to find the control based on the current Caption ( check pre capture ), Is that possible ?
Or is there another way ?
init pane.png
Init Pane
init pane.png (11.67 KiB) Viewed 804 times
I tried that to play with the option but I could get it working ..
Ranorex.png
Ranorex
Ranorex.png (66.74 KiB) Viewed 804 times
Thanks,
/Eric

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Search control base on caption

Post by odklizec » Tue May 05, 2015 1:40 pm

Hi,

Could you please post a Ranorex snapshot of the element in question? You can find how to create one here:
http://www.ranorex.com/support/user-gui ... files.html
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Re: Search control base on caption

Post by eric.franc » Tue May 05, 2015 5:28 pm

Hello,

I have included the file.

Not all control could be saved apparently.

You can check the control 5829 is is the same king of logic as the previous one I mentioned.
2015-05-05_19-24-47.png
2015-05-05_19-24-47.png (3.7 KiB) Viewed 784 times
The control look like this
2015-05-05_19-26-59.png
view
2015-05-05_19-26-59.png (2.49 KiB) Viewed 784 times
Thanks,
/Eric
Attachments
1.rxsnp
(404.8 KiB) Downloaded 56 times

eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Re: Search control base on caption

Post by eric.franc » Wed May 06, 2015 6:25 am

Hello,

It seems that the Id are always the same I have restarted three time the application and I always get Text'5829'.
why can't it be found when I play the recording ?

Thanks,

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Search control base on caption

Post by odklizec » Wed May 06, 2015 7:46 am

Hi,

I'm not sure I understand what exactly you want to achieve? You want to find the edit control based of the label control (let's say "Type Of Part")? If the control IDs are persistent, then you should be able to access that edit directly, using controlid 5829?

If the path fails during runtime, then there is most probably something different in the path/GUI? If the path is too complicated, with a lot of ID's, elements of even worse instance numbers, there is a high probability something will fail. I don't know anything about Solidworks, but I clearly remember from my previous job, that another Dassault Systemes application called Catia changes the control IDs a lot between each run ;) So I would suggest to forget about ControlIDs and use other attributes in your paths.

Try this simplified path:

Code: Select all

/form[@title~'^SOLIDWORKS']//form//text[@class='Edit' and @accessiblename='Type Of Part']
If you are using Recording, you can make Ranorex to prefer another attribute over ControlID. Check this blog post about automating GUI with dynamic IDs:
http://www.ranorex.com/blog/automated-t ... ynamic-ids
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

eric.franc
Posts: 20
Joined: Tue May 05, 2015 11:25 am

Re: Search control base on caption

Post by eric.franc » Wed May 06, 2015 11:12 am

Hello,

Thanks for your reply. You pointed me out to the problem.
The tab page in wich the control is created is having a new ID each time.

I unselected it and everything started to work :).

Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Search control base on caption

Post by odklizec » Thu May 07, 2015 7:17 am

Great! You are welcome ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration