Ranorex finds element though it's not existing

Ranorex Spy, Recorder, and Studio.
boris0dev
Posts: 17
Joined: Fri Nov 09, 2018 11:28 am

Ranorex finds element though it's not existing

Post by boris0dev » Thu Jan 09, 2020 9:08 am

Hi,
I have the following issue:
On a webpage a div with some text is displayed as well as a button to close this div. After closing this div it is removed from the dom (it's an angularjs 1 web app).
I check for the none-existence for this div.
In 1 of 4 testruns Ranorex still finds this div though it is removed from the dom.

To solve or at least to examine this issue I tried the following:
- if the element was found I set a breakpoint, look at the web app and its dom: the element isn't visible as well as removed from the dom
- if the element was found I set a delay of 1 minute and try to find again the element (hoping that it is _not_ found) - but it is still found

Any hints?

Thanks, Boris

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

Re: Ranorex finds element though it's not existing

Post by odklizec » Thu Jan 09, 2020 9:30 am

Hi,

I'm afraid, that without seeing this issue in action, there is not much anyone here can do or suggest. I would suggest to add "create snapshot" action right after the existence check, or even better in "try...catch" block. If existence check fails, the test will create the snapshot. Eventually, create the snapshot manually during breakpoint. Snapshot should tell us if xpath for the element you are looking for does exist or not.

Another thing you can try is to disable "Use cache" for parent element of the problematic element. This could eventually help with "phantom" finds of element, which are no longer available? ;)
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

boris0dev
Posts: 17
Joined: Fri Nov 09, 2018 11:28 am

Re: Ranorex finds element though it's not existing

Post by boris0dev » Mon Jan 13, 2020 11:37 am

Thanks for the hint regarding the snapshot. It helped me to identify the problem

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

Re: Ranorex finds element though it's not existing

Post by odklizec » Mon Jan 13, 2020 12:03 pm

Hi,

You are welcome. I'm glad it helped ;)
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