Index vs ControlID

Ask general questions here.
BeardMJ
Posts: 33
Joined: Wed May 31, 2017 8:39 am

Re: Index vs ControlID

Post by BeardMJ » Tue Jul 04, 2017 2:15 pm

Hi Doug/Ol

I've played around with the "weight" settings and it looks to have worked. I reduced the "native window" control ID down to 0. Ranorex now identifies the instance for the Afx setting, after closing down the system and opening again it looks to have worked.

I assume then from the sanpshot provided Ranorex then looks to the afx instance, sees it has serveral then allocates an instance number?

The one thing i can't seem to work out is the "rule condition". I add atttribute control ID and the 5 digit number.

Thnaks again.
You do not have the required permissions to view the files attached to this post.

Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Index vs ControlID

Post by Vaughan.Douglas » Thu Jul 06, 2017 3:58 pm

The instance attribute is only in the context of itself and siblings. So you can have multiple objects of the AFX class with an instance equal to 0. You have to keep in mind that Ranorex looks at the UI as a tree not in a visual spacial relationship like you do.

Please read through the Weights and Rules section of the Ranorex user guide and understand that the rules are per attribute of a specific capability. In other words Class, ControlID, and Instance are each attributes of the "nativewindow" capability. So your rule conditions are telling Ranorex when to apply the given rule during recording. So for example you want to create a rule named "AFX Element". The Capability is "NativeWindow" and the attribute is "controlID" and the Weight value that is going to apply WHEN and ONLY WHEN the following rule conditions are TRUE.

Source = "self"; attribute = "instance"; and Match RegEx = "^(?:[1-9]|\d\d\d*)$" (from stack overflow)

This rule will then use the entered weight for the controlID only when the value of the instance attribute is greater than 0.

I think if you set up a rule with no conditions, then that rule will always apply.

I don't use Weights and Rules much at all as I tend not to record and play. I write out my RxPath manually based on the AUT I have in front of me. Unfortunately I only have your snapshots and your AUT is tricky.

I would suggest you contact support and see if you can get some of their time to help you identify your objects. You may have done this in the past, but you might pick up on things you've missed now that you have a bit more experience. I can only take you so far speaking in generalities and working through your snapshots.
Doug Vaughan

BeardMJ
Posts: 33
Joined: Wed May 31, 2017 8:39 am

Re: Index vs ControlID

Post by BeardMJ » Thu Jul 06, 2017 5:07 pm

Hi mate

Changing the weight rule for the native window "controlID" has worked perfectly, the Afx is now picked up and the instance with no control ID. Meaning when I close down my SUT and re-open I find all the objects with no issues.

Yes the rule does is indeed fire every time but I have no issues with this with the elements I want to identify.

I will read the post you supplied.

Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Index vs ControlID

Post by Vaughan.Douglas » Thu Jul 06, 2017 7:09 pm

BeardMJ wrote:Hi mate

Changing the weight rule for the native window "controlID" has worked perfectly, the Afx is now picked up and the instance with no control ID. Meaning when I close down my SUT and re-open I find all the objects with no issues.

Yes the rule does is indeed fire every time but I have no issues with this with the elements I want to identify.

I will read the post you supplied.
That's great news!! I must have misunderstood what you were telling me :oops:
Doug Vaughan