Ranorex sometimes clicks on position 0/0 when the element is located somewhere else

Ranorex Spy, Recorder, and Studio.
nikolang
Posts: 7
Joined: Mon May 06, 2019 9:45 am

Ranorex sometimes clicks on position 0/0 when the element is located somewhere else

Post by nikolang » Wed Oct 09, 2019 10:16 am

When I run my tests over Jenkins (msbuild) almost every test fails on a random step because Ranorex wants to click (an existing element) with the wrong position (0/0). This happens randomly. It seems like ranorex finds the element but calculates a wrong position. When running the test suite directly from ranorex this does not happen.

What causes and posssible workarounds can you think of?

User avatar
Stub
Posts: 270
Joined: Fri Jul 15, 2016 1:35 pm

Re: Ranorex sometimes clicks on position 0/0 when the element is located somewhere else

Post by Stub » Wed Oct 09, 2019 10:49 am

I get something like that when I run our Ranorex tests against an x64 build of our legacy application. Works fine on the Win32 build of the same application. Only occurs on combobox controls in the x64 build, where it clicks at coordinate (0,0) of that element (as opposed to screen position (0,0) I mean). Doesn't matter whether I run the test from Ranorex Studio or via MSBuild. So it's not the same as you're describing unfortunately, hence this will be of little help, I know.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5187
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex sometimes clicks on position 0/0 when the element is located somewhere else

Post by odklizec » Wed Oct 09, 2019 10:52 am

Hi,

In case of web app, this kind of issue is usually caused by not entirely loaded page at a time of accessing an element, which may already be visible, but not fully loaded yet? Have you tried to add and @state='compete' attribute to the DOM xpath? This should assure that the Ranorex actions are performed only after the page is fully loaded.

Another possible cause could be a non-unique xpath, which returns multiple elements, where only one is correct and the other one is hidden or out of visible screen area? In case there are found multiple elements for given xpath, Ranorex always picks the first one! And because the order of elements could differ with each test run, your test could randomly fail for the same element.

Have you tried to debug the xpath at a time of failure? When the test fails, try to search the xpath with standalone spy. Eventually, add Capture Snapshot action at places, where the test usually fails. This could help you with debugging the problematic element/action.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration