Why is my script running so slow (sometimes)

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

Why is my script running so slow (sometimes)

Post by Aracknid » Tue Aug 10, 2010 10:06 pm

Hello,

I'm using the 30-day trial, version 2.3.3.8879, on a Windows XP SP3 machine. The machine itself is old and not the greatest, but it still seems to be good enough. It's a P4 2GHz with 2GB or ram. I've used this for other automation and it was fine.

I've written some code to test a Silverlight control in our application. When I use the track option in the element browser, it sometimes finds the elements in the Silverlight control relatively quickly. But sometimes, it cannot find them at all, or it takes a long time, like 30 seconds to a minute (I have to leave the mouse pointer on the control for that long for it to discover it).

So in my script, it often is failing because the timeout of 10 seconds is not enough for it to find the control.

My question is why is this happening? That same script, untouched, can often work and find the items in the control quickly.

I've restarted Windows and started my application under test, started Ranorex, put it in the same state as all other runs, and it just cannot find the elements in the Silverlight control quickly at all.

Any thoughts on this?

As an aside, how do I change the timeout in code?

Thanks,

Aracknid.

QAWebTester
Posts: 3
Joined: Wed Aug 11, 2010 7:38 am

Re: Why is my script running so slow (sometimes)

Post by QAWebTester » Wed Aug 11, 2010 7:52 am

Hi Aracknid,
Use "Search Timeout" property settings to resolve the issue.
Search for "Repository Configuration" topic in Ranorex tutorial and follow the "Search Timeout" property settings for the object under discussion. Try increasing the timeout value property.

Sometimes when working with Silverlight I found that the objects gets identified quickly if they are cached. You might face this search issue mostly during first launch of the page. Usually before I run my Silverlight test scripts I manually browse the pages I might visit in the script. This is only a dirty temporary solution.

One more solution will be to refresh the object repo of parent object before you perform action on the child object under question. This refresh statement should precede your child object identification statement or action statement. This could be a permanent solution.

Hope this helps.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Why is my script running so slow (sometimes)

Post by Support Team » Wed Aug 11, 2010 11:27 am

Ranorex 2.X internally uses UI Automation to automate and interact with Silverlight applications. We experienced some weird behavior with UI Automation on Silverlight applications ourselves - that's why we are already thinking of alternatives to replace UI Automation. Most of these issues apply to the Tracking feature, but your issue seems to be a new one. Usually, once you have successfully tracked an element and got its RanoreXPath, you should have no problems finding that item later in your script.
Aracknid wrote:I have to leave the mouse pointer on the control for that long for it to discover it
Just a hint: Ranorex will only try to track elements at a specific mouse position once; if you leave the mouse at the position, Ranorex won't track again until you move the mouse again. Consequently, if tracking fails, try moving the mouse a little away from and then again onto the element. Or use Instant Tracking (see below).

Could you please check the following:
  • What is the CPU load while tracking the problematic UI elements?
  • Did you try Instant Tracking (see Ranorex User Guide) instead of using the Track button?
  • Is there a difference between the first try to track the element and consecutive tries?
  • We experiences some issues trying to track items in newly created popup windows; could this issue be related to popup windows?
  • Could you provide us a sample application and a step-by-step instruction on how to reproduce that issue?
Regards,
Alex
Ranorex Team
.
Image

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Wed Aug 11, 2010 3:16 pm

Support Team wrote:
  • What is the CPU load while tracking the problematic UI elements?
So, when not tracking and just sitting there waiting for me to do something, the CPU is 2%. Once I hit Track and try to find something (but not clicking on it) the CPU load jumps up to 100% and the IE application is nearly 100% as well. That cannot be good... :) After waiting for a while 1 - 2 minutes, the element browser shows the item and the CPU drops back to 2%.
Support Team wrote:[*]Did you try Instant Tracking (see Ranorex User Guide) instead of using the Track button?
I had not tried this (didn't know about it), but I tried it now and it doesn't seem to make any difference with respect to speed of tracking elements.
Support Team wrote:[*]Is there a difference between the first try to track the element and consecutive tries?
There doesn't seem to be, but there is something happening that I don't understand and cannot explain. Specifically the issue where it suddenly starts working quickly versus slowly. Right now as I try out these tests, it is very slow to track (either method), taking well over 1 minute to find the elements, closer to 2 minutes really (obviously due to CPU and IE usage). I'm going to try to do some more work while I wait to hear back from you, to see if I can get it working quickly again. Maybe I'll be lucky and figure out why...
Support Team wrote:[*]We experiences some issues trying to track items in newly created popup windows; could this issue be related to popup windows?
While I do have popups, I'm not trying to track them and they are not "popped up". Speaking of issues with popups, I've noticed when a popup form (simulating a dialog in Silverlight I guess) appears, when tracking was working quickly, it was not able to track the elements in the popup, instead finding all the elements underneath it. Is this what you are referring to with popup issues?
Support Team wrote:[*]Could you provide us a sample application and a step-by-step instruction on how to reproduce that issue?[/list]
I wish I could, but I cannot. Instead, could someone Webex into my environment? I'd be happy to show you the issues. I'm currently on day 28 of 30 of my evaluation, so it would need to be soon.

Thanks,

Aracknid

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Wed Aug 11, 2010 3:40 pm

Not to complicate matters or throw this off topic, but is it possible that the installation of VS 2010 (and .NET 4 and other VS 2010 dependencies) is the reason for these issues? Prior to installing VS 2010, I was occasionally having speed issues, but not like now.

I also tried to simplify matters down, by going to our pretty plain and straight forward login web page. While tracking was better, it did seem a bit sluggish, specifically once I went into the HTML document part of the IE browser itself. The IE back, forward button and address edit box, and other controls were fairly fast to be identified, but the username and password fields, as well as buttons to log in within the HTML page were slower to be found and the CPU usage jumped up to 100% for a few seconds.

So, based on this, I don't think the problem is the Silverlight control itself, but more to the point that it is deeper within an HTML page and that it has many elements within it, causing it to take longer to analyze all the elements.

Thanks,

Aracknid

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Wed Aug 11, 2010 5:03 pm

Just an update...

I went to a VM I have that does not have Visual Studio on it, and does not have .NET 4. It's a Win XP SP3 system with ,NET 3.5 SP1 (and previous .NET files as well). It only has 1 GB of memory allocated to it.

I brought over my project and put my app in the start state I need for my script and it ran without issues. Tracking was working fine (a wee bit slower than normal, but this is expected due to it being a VM).

I'm really thinking VS2010 or .NET4 is the issue on the other system...

Aracknid.

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Tue Aug 17, 2010 9:44 pm

It's been a few days, and I was wondering if anyone at Ranorex had any feedback on my thoughts of VS2010 and/or .NET 4 being the reason for the slow tracking?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Why is my script running so slow (sometimes)

Post by Support Team » Wed Aug 18, 2010 8:57 am

Aracknid wrote:'s been a few days, and I was wondering if anyone at Ranorex had any feedback on my thoughts of VS2010 and/or .NET 4 being the reason for the slow tracking?
The reason we have not answered, yet, is we don't have a satisfactory answer to that problem. We have a few machines ourselves running Visual Studio 2010 and Silverlight 4 and don't experience any performance problems. So we wanted the community to jump in and give its thoughts rather than us "closing" the topic by answering too early.

There are a few things coming to my mind that would be interesting to know and that you might try to solve the problem:
  • Do you experience that performance problem only with Silverlight applications? What about simple HTML documents and WPF desktop applications, do those perform normally?
  • Are the Ranorex Internet Explorer and Mozilla plugins correctly installed? Could you try reinstalling Ranorex? See this post on how to verify the plugins/addons are correctly installed:
    http://www.ranorex.com/forum/unable-to- ... html#p5698
  • Did you ever have any Beta version of Visual Studio or Silverlight installed? Did you try reinstalling Silverlight on the problematic machine?
Regards,
Alex
Ranorex Team
.
Image

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Wed Aug 18, 2010 3:20 pm

I'm not sure I can do much at this point on my side, because my 30 day trial expired on this machine that is a real machine (not a VM). I'm currently setting up some VM's with various OSes and Visual Studio 2010 for other reasons. I can install the trial on these and see if I can recreate and let you know.

If you want to somehow extend my trial by a few days so I can try on the original system, let me know.

Aracknid.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Why is my script running so slow (sometimes)

Post by Support Team » Wed Aug 18, 2010 5:07 pm

Hi,

Please send an email to [email protected] . Then we will create you an Extended Trial License and you must not set up this virtual machines.

Regards,
Peter
Ranorex Team
.
Image

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Tue Aug 31, 2010 3:33 pm

Support Team wrote: Do you experience that performance problem only with Silverlight applications? What about simple HTML documents and WPF desktop applications, do those perform normally?
This problem is not limited to Silverlight. It occurs with any part of my application. Even on the most simpliest page (our login page), it takes a few seconds to find the edit boxes and/or buttons, which is OK but not as fast as I would have thought. But once I'm in the app and I'm trying to find something deeper within the xpath (be it normal HTML or Silverlight items) it takes a very long time and uses all the CPU.
Support Team wrote: Are the Ranorex Internet Explorer and Mozilla plugins correctly installed? Could you try reinstalling Ranorex? See this post on how to verify the plugins/addons are correctly installed:
http://www.ranorex.com/forum/unable-to- ... html#p5698
The plug-ins are correctly installed as far as I can tell from this post. I also un-installed and re-installed Ranorex, and it didn't make any difference. I also noticed on this system that the Silverlight 3.0 SDK was installed. I un-installed that as well and that made no difference.
Support Team wrote: Did you ever have any Beta version of Visual Studio or Silverlight installed? Did you try reinstalling Silverlight on the problematic machine?
I did not have any Beta VS2010 or Silverlight on the system. I did have VS6 (yup that really old one) before I installed VS2010. I also used to have Silverlight 2.0, and then I installed 3.0. As mentioned above, there was a silverlight SDK. I don't remember installing that, so maybe it's installed as part of VS2010? Anyway, the problem is not limited to silverlight.

Again, if it helps, I'm willing to do some sort of remote connection so you can see what's going on. Let me know if you are interested.

Thanks,

Aracknid.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Why is my script running so slow (sometimes)

Post by Support Team » Wed Sep 01, 2010 3:48 pm

Hi,

Just a hunch: Is there some kind of anti-virus application which blocks the system?

Except for your issue, we don't know of any incompabilities between Ranorex and VS 2010 considering performance. In some cases it is possible that it takes longer time to track objects inside a Silverlight application, but this caused by the Microsoft's UIAutomation technology in general and is not specific to a .NET Framework or Visual Studio version. When we tracked a Silverlight application in a "slower" phase, we also observed that the CPU Load was nearly 100%, but we were not able to reproduce this on a simple webpage as you told us.
Aracknid wrote:Again, if it helps, I'm willing to do some sort of remote connection so you can see what's going on. Let me know if you are interested.

Of course we can set up a meeting. Just contact us by mail [email protected]

Regards,
Peter
Ranorex Team
.
Image

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Thu Sep 02, 2010 2:40 pm

Fantastic! I disbaled McAfee Anti-Virus (everything that I could disbale is now disabled) and it worked really super fast.

Going back to my original post, I'm really confused as to why it was not so slow when I originally started using it. I always had McAfee running. Very strange.

Anyway, I'm happy that we got this resolved.

Is there a way to make it work fast with McAfee still running? I'm not supposed to disable the Anti-Virus. What are you doing under the covers that Anti-Virus software is causing it to slow down?

Thanks,

Aracknid.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Why is my script running so slow (sometimes)

Post by Support Team » Thu Sep 02, 2010 2:47 pm

I'm really glad that we finally found the reason for this issue :D
Aracknid wrote:What are you doing under the covers that Anti-Virus software is causing it to slow down?
I don't think that we are doing something that could interfere with McAfee - we are not writing files or anything like that. The fact that everything slowed down after installation of VS 2010 rather means to me that VS 2010 or the .NET Framework 4.0 seems to do something that McAfee regards as suspicious.

Regards,
Alex
Ranorex Team
.
Image

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

Re: Why is my script running so slow (sometimes)

Post by Aracknid » Thu Sep 02, 2010 4:32 pm

Now that we know Anti-Virus is an issue, i discovered that my test machine had an old version of McAfee installed (version 3.6.0.453) and the person here responsible for my test machine said I should update to the latest version we have available to us. I installed 8.7.0i and even with "Access Protection" and "On-Access Scanner" enabled, everything worked well.

I believe that it is likely the older version of the software was just not friendly to what goes on under the covers, or perhaps it was configured in some way I'm not aware. But once uninstalled, and replaced with the new version and its default settings, everything still works good.

Regards,

Aracknid