Page 1 of 1

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

Posted: Fri Apr 17, 2015 1:41 am
by c676228
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

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

Posted: Fri Apr 17, 2015 5:35 am
by odklizec
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?

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

Posted: Fri Apr 17, 2015 6:32 am
by c676228
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.

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

Posted: Fri Apr 17, 2015 6:34 am
by c676228
If the above explanation is not clear enough, I will post exact code tomorrow. It is on my working computer.

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

Posted: Fri Apr 17, 2015 8:53 am
by odklizec
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)?

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

Posted: Fri Apr 17, 2015 4:32 pm
by c676228
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.

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

Posted: Tue Apr 21, 2015 12:56 pm
by Support Team
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

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

Posted: Tue Apr 21, 2015 4:41 pm
by c676228
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.