cannot find the list item after user code is used before it

Ask general questions here.
c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

cannot find the list item after user code is used before it

Post by c676228 » Fri Apr 17, 2015 1:41 am

Hi,

I have a action step runs perfectly fine without user code function call before that step.
After I insert a function call from user code before that the step, 90% of the time, I will get an error state that the list item (from a combo box) cannot be found. But if I run the selected steps without the user code, it runs perfectly fine and locate that list item without any issue. I can duplicate the case many times.

It gives me the impression that after user code, the script no longer can locate the UI element even the active window is the exactly same and the user code just make a select from another combo box right above it.
Any idea about that?

Thanks,
Betty

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

Re: cannot find the list item after user code is used before it

Post by odklizec » Fri Apr 17, 2015 5:35 am

Hi,

The question is, what exactly your user code does and what are the steps after the user code? Could you please show us your user code and recording steps?
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

c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

Re: cannot find the list item after user code is used before it

Post by c676228 » Fri Apr 17, 2015 6:32 am

In the user code, the script will select a combo box, (combo1) then select a list item based on the external data source column data. that's it.
The Combo1 is right above the following Combo box (Combo2).
In the action table,
the next action following the actions on combo1 is clicking on the Combo2, then select one of the two list items ( off, on).
The strange part is the script can locate the Combo2, but cannot locate the list item inside it.
Very occasionally, it can locate the list item, which is very bizarre.
When I edit the list items in Ranorex Spy, it simply cannot locate the items.
While I remove the user code function call before the actions on Combo2. Problem disappeared.

c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

Re: cannot find the list item after user code is used before it

Post by c676228 » Fri Apr 17, 2015 6:34 am

If the above explanation is not clear enough, I will post exact code tomorrow. It is on my working computer.

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

Re: cannot find the list item after user code is used before it

Post by odklizec » Fri Apr 17, 2015 8:53 am

Hi,

In my opinion, it looks like a timing issue? But it's hard to tell for sure without seeing the user code, recording action and the application under test (or at least Ranorex snapshot of the problematic elements).

What you can try is to add a Delay or WaitFor Exists action right after the User Code or just before the failing recorded action. This might help with timing issue, when the action is started before the element in question is ready. But it may not help if the problem is something else (an error in your user code)?
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

c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

Re: cannot find the list item after user code is used before it

Post by c676228 » Fri Apr 17, 2015 4:32 pm

Hi,

I tried Delay and Waitfor yesterday. It didn't work.

I figured out today. I believe it is a bug from Ranorex.
I noticed that after the user code, the active window switches to another irrelevant application. Like today, it switches to a web page I was looking at.

I have to specifically add repo.SectionsDialog.Self.Focus() to fix the issue. :D
That's pretty strange to me since the user code was working on controls within the repo.SectionsDialog.
I didn't switch to any other form or windows at all.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: cannot find the list item after user code is used before it

Post by Support Team » Tue Apr 21, 2015 12:56 pm

Hi c676228,

as odklizec already wrote, we need more information about your code and what exactly you are doing.
Can you also tell us which version of Ranorex are you using?
You can also contact us by mail directly. We can schedule a remote session in order to analyze on your machine directly if it's a bug.

Regards,
Bernhard

c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

Re: cannot find the list item after user code is used before it

Post by c676228 » Tue Apr 21, 2015 4:41 pm

The Ranorex version I am using is 5.3.0.22324.
I will contact your support for remote session this Fri.

Thanks for the offer. The remote session does help.