Page 1 of 1

How can I record a generic xpath without the machine name

Posted: Wed Aug 24, 2016 4:26 pm
by fester13579
I am currently building my 1st WEB based test cases on “MachineA” but will later run this on “MachineB,C,D...”.

While building my recordings, each click is recording the full path of A in every xpath and I then have to edit every single one to use a regex match on a substring so that it will still match when running on B.

Is there a way to make the recorder not be so literal and thereby save me the re-editing time on all my clicks.

I thought perhaps this would help but apparently it does not
The unique ID search can be enabled/disabled within the “General settings” -> 'Enable search by unique ID (if available)'. “

Thanks...
foo2.png

Re: How can I record a generic xpath without the machine name

Posted: Thu Aug 25, 2016 1:55 pm
by Support Team
Hi fester13579,

I would suggest trying to work around this issue as follows.
  • Track the IFrame element with Ranorex Spy and add it to the repository
    add_to_repository.png
  • Convert the item to a rooted folder
    convert_to_rooted_folder.png
  • Edit the path for the rooted folder via the Path Editor and apply the regular expression
  • As a consequence, new recorded or tracked items will be located within this rooted folder and you won't need to adjust the regular expression again and again
    repository_result.png
Alternatively, you could try creating a RanoreXPath Weight Rule that prefers a different attribute when generating the path (assuming that there is a different attribute that could be used for identifying the IFrame).

If you need more information please do let me know.

Sincerely,
Johannes

Re: How can I record a generic xpath without the machine name

Posted: Fri Aug 26, 2016 3:21 pm
by fester13579
Thank you...