Apply changes to the xpath during creation

Ask general questions here.
mdietrich
Posts: 2
Joined: Mon Sep 01, 2014 2:38 pm

Apply changes to the xpath during creation

Post by mdietrich » Mon Sep 01, 2014 2:54 pm

Hello,

I am trying to create automated tests for a web application with Ranorex and I have the following problem:

I want to use the same recording modules in the tests for multiple browsers, but the dom tree varies based on what browser is used. For example, a given element is in the third body tag in one browser and in the first body tag in another browser. What I do now is manually replace the .../body[pos()=1]/... with .../?//... within the xpath so that the element is found in both browsers.

Is there any way to automate that process, so that the above mentioned replacement is executed within the process where the xpath is created while tracking the element, just like you can edit the path weights?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Apply changes to the xpath during creation

Post by krstcs » Tue Sep 02, 2014 1:51 pm

First, the HTML standard states that a HTML document should only have one (1) html, body and head tag. No more. If your AUT's page has more than one body tag, then the page is malformed and needs to be fixed. While some browsers might render it correctly, it is still invalid and should not be done. Ranorex may or may not see the body tags correctly, which is probably why you are seeing the doms differently.


Second, no, there is no way to automate the type of path you are wanting. You could change the path generation algorithm in the Ranorex settings ( and see which one works better for you, but Ranorex can't account for all situations.
Shortcuts usually aren't...