Find Items sometimes not working...

Ask general questions here.
User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Find Items sometimes not working...

Post by Aracknid » Tue Nov 25, 2014 10:42 pm

Hi,

I recently upgraded my testing environment to Ranorex 5.2 (from 4.03), and my browsers to the latest IE 11 hotfixes and Firefox ESR 31.2 (we only test on ESR versions).

I'm having problems with Find not working at times. All my scripts are written in VS2012 using the Ranorex API to interact with UI.

One example, I have a function to sign out of my client website, and every script calls this. Basically there is a button in the top right corner of the main window. Sometimes when I call the sign out routine, it cannot find the button. If I re-run the script it is fine. It really seems arbitrary. By default I look for the control for up to 2 minutes... so I know it should find it. I also added code to try again if it fails but that doesn't help.

Another example, I have a dialog load up, and I do things in this dialog and then dismiss it. When I try to find anything after this, nothing works. It's almost as if the find engine (or perhaps ranorex itself) has just died. My script will keep working but usually at this point it's all vb.net code trapping errors and logging failure messages.

Does this make sense? Hopefully I'm explaining it clearly.

Aracknid

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

Re: Find Items sometimes not working...

Post by krstcs » Wed Nov 26, 2014 3:09 pm

I would suggest a clean re-install first.

1. Uninstall Ranorex.
2. Reboot the computer.
3. Reinstall the latest version (5.2.1).

If that doesn't solve it, then I would use Spy and make sure that the objects in question are not changing properties during the run. This can cause Ranorex to have invalid references, and sometimes it doesn't realize there's been a change. It can also cause the RXPath to be invalid.
Shortcuts usually aren't...

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Find Items sometimes not working...

Post by Aracknid » Wed Nov 26, 2014 3:45 pm

I didn't know 5.2.1 was out... I'll try your suggestion.

Aracknid

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Find Items sometimes not working...

Post by Aracknid » Mon Dec 08, 2014 7:23 pm

So, after various amounts of experimenting, I thought I'd post a summary of what happened and how I solved it.

First, the patch didn't make a difference. I still had issues after applying the patch.

Second, uninstall, reboot, reinstall didn't help either.

Third: I pondered your statement of changing properties. We are storing the Form (which is on the root level of Ranorex.Host.Local) in a global variable, making it accessible from any place in the code. When we call our click function, there is code to handle clicking in various ways here. We allow passing in a parent object to look off of if required. If no parent object is provided, we look off of the global Form object. While this works 99.9 percent of the time, we were finding that with long runs or runs that seemed to load specific dialogs written in older code in our AUT (we are upgrading it all to .NET and ASPX pages, but some parts are still .ASP) it would no longer find items off of the global Form object. Why this happens I don't know... but after experimenting with different options, we found that resetting the global Form object (basically finding it again) would resolve the issue.

Thanks,

Aracknid