Confusion between 2 text fields

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
ThoMask
Posts: 1
Joined: Fri Jul 10, 2020 1:07 pm

Confusion between 2 text fields

Post by ThoMask » Fri Jul 10, 2020 1:53 pm

Hello,

I'm new with Ranorex so I'm very sorry if my question is not relevant.

I have a recorded test for a desktop application. In this application I have multiple pages with various number of text fields. It seems that Ranorex is confused by similar text fields on different pages. Here is a screenshot of the problem (in French :D ):
Image
As you can see on the right panel, the item 84 is a field in kg below another field in kN (which is the normal behaviour). But, on the panel below, it shows 4 similar text fields in kg. Those ones don't belong to the current page. Then, of course, Ranorex doesn't find it and an error is generated.

How can I fix that? Can you help on this subject?

Thank you!
Attachments
confusion.rxsnp
(1.72 MiB) Downloaded 2 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 12143
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Confusion between 2 text fields

Post by Support Team » Tue Jul 14, 2020 8:23 pm

Hi ThoMask,

When adding a new repository item, Ranorex first checks if any of the existing RxPaths match the item you are trying to add. If one does, it does not add a new item as this would be redundant. When Ranorex does not find an existing matching RxPath in the repository, it will add a new repository item with a RxPath that is automatically generated and points to one item in the AUT (in its current given state).

The provided Snapshot is not a Snapshot of your AUT in the same state as the screenshot provided, but I see two similar fields with the labels "MMRA sans frein" and "MMRA frein à inertie". When clicking on each of these in the Snapshot, we can see the automatic generated RxPath changes (at the top).

Here are some sample RxPaths to these inputs (simplified). Ranorex is using a different parent container index to differentiate between the two:
MMRA sans frein: /form[@title>'EVI Client [QA] (5.9.0.20200708-1308-b702)']//container[3]/text[@type='AllowCopyWhenDisabledText']
MMRA frein à inertie: /form[@title>'EVI Client [QA] (5.9.0.20200708-1308-b702)']//container[2]/text[@type='AllowCopyWhenDisabledText']

There are a thousand+ different ways a RxPath could be built for any element. Often times the auto-generated RxPath is great, but sometimes it needs some manual adjusting and really depends on the AUT. These particular elements have a lot of other attributes that we can use in the RxPath that may be better than just @type='AllowCopyWhenDisabledText' because the type is not very unique in this AUT. Perhaps the @text attribute is more unique, or maybe both combined?

Example RxPath: /form[@title>'EVI Client [QA] (5.9.0.20200708-1308-b702)']//text[@type='AllowCopyWhenDisabledText' and @text='1000']

RxPath does have a learning curve but is one of the first things I highly recommend learning when you are new to Ranorex. This is the root of many test errors and being able to understand how RxPath works and how to update it if needed will greatly help in your future test development. The Ranorex Spy tool can assist with customizing the RxPath. Below are a few links that go into more detail on Rxpath which may be helpful.

Ranorex Spy User Guide: https://www.ranorex.com/help/latest/ran ... roduction/
RanoreXPath User Guide: https://www.ranorex.com/help/latest/ran ... roduction/
RanoreXPath Blog: https://www.ranorex.com/blog/ranorexpat ... nd-tricks/

I hope this helps but please let us know if you have any more questions. Note, if you own a Ranorex License with active support, you can always contact us here: https://www.ranorex.com/support-query. If you are evaluating Ranorex, we can assist you directly here: https://www.ranorex.com/prices/contact/.

Cheers,
Ned
.
Image