Page 1 of 1

Search control base on caption

Posted: Tue May 05, 2015 11:34 am
by eric.franc
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
I tried that to play with the option but I could get it working ..
Ranorex.png
Thanks,
/Eric

Re: Search control base on caption

Posted: Tue May 05, 2015 1:40 pm
by odklizec
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

Re: Search control base on caption

Posted: Tue May 05, 2015 5:28 pm
by eric.franc
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
The control look like this
2015-05-05_19-26-59.png
Thanks,
/Eric

Re: Search control base on caption

Posted: Wed May 06, 2015 6:25 am
by eric.franc
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,

Re: Search control base on caption

Posted: Wed May 06, 2015 7:46 am
by odklizec
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

Re: Search control base on caption

Posted: Wed May 06, 2015 11:12 am
by eric.franc
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

Re: Search control base on caption

Posted: Thu May 07, 2015 7:17 am
by odklizec
Great! You are welcome ;)