How to find SilverLight object's Load Time?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
thangavel
Posts: 50
Joined: Tue Jun 09, 2009 6:48 am
Contact:

How to find SilverLight object's Load Time?

Post by thangavel » Tue Jun 30, 2009 5:38 am

Hi,

Our business application contains SilverLight objects. When opening the page i'm checking the "Ready State" of the browser & checking whether Document Complete. I'm checking the Busy status also.

Page has been loaded successfully (Busy status is 'false' , Ready state is 'Complete'). But SilverLight objects are still loaded inside the page. I'm unable to check for that.

How to check SilverLight object's Load Time?
Regards,
Thangavel.S

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

Re: How to find SilverLight object's Load Time?

Post by Support Team » Tue Jun 30, 2009 4:13 pm

Hello Thangavel,
when searching your SL object you can set the delay to a sufficiently high value and find out how much time it really takes until the object is loaded in your page.
So you can use this time after that to search the element when loading the page.


Regards,
Mhosen
Ranorex Support Team
.
Image

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: How to find SilverLight object's Load Time?

Post by Ciege » Tue Jun 30, 2009 4:29 pm

Support Team wrote:when searching your SL object you can set the delay to a sufficiently high value and find out how much time it really takes until the object is loaded in your page.
So you can use this time after that to search the element when loading the page.
I can't say that I agree with this answer. By setting a hard wait time you are setting yourself up for eventual failure. If for some reason your object does not load in that time then your entire automation process has failed. Further, if you set it too long, then you are constantly waiting for no reason before you are able to continue. If you have one or more objects to wait for throughout your automation process you can compound your total wait time and loose productivity.

Another downside to setting a hard coded wait time is if you move your automation to another machine (or machines) that have different specs. Now you are not sure how long the wait should be. Or if your dev team delivers a new app. Again your wait time is now unknown.

Now, I have not done ANY SL testing at all, so I can't help authoritatively but... With the DOM (like you mentioned) you can check the readystate of the browser. In your case the browser is indeed complete but your SL app is not yet. In the DOM each object has a readystate property. You should be able to drill down into the DOM and get the readystate of DOM objects (and not just the browser) and check for completeness of them. Since I have not done any SL work, I do not know if the SL object has a readystate property to check on.

Are there any items within the SL object you can get existence on to verify that the object has loaded? Wrap you check loop with a try catch block so that you will not error out of you script while checking for the objects. And/Or is there anything in the browser that loads AFTER the SL object has loaded? Can you check for and wait for that to appear?

Hope this helps you in the right direction!
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: How to find SilverLight object's Load Time?

Post by Support Team » Wed Jul 01, 2009 9:56 am

I think what Mhosen tried to say is that you should use the FindSingle(RxPath, Duration) method overload and specify a high (but not infinite) timeout. The FindSingle method will return, once the element corresponding to the RanoreXPath is found, so there is no unnecessary wait time. And FindSingle will throw an exception if the timeout is reached and the corresponding element has not been found - in case there is some network problem and the SL application does not load at all. (If you don't want an exception to be thrown, use Find instead of FindSingle. It will return an empty list, if the timeout is reached and no element corresponding to the path is found, yet.)

So far as I know there is currently no way to get the loading state of a Silverlight object using Ranorex. Consequently, you have to search for some element inside your SL application to measure the time it takes to load the SL application; i.e. some element that is accessible first when the SL application is fully loaded. The code for that could look like the following:
// high timeout value in case that application does not load at all
Duration timeout = 60000;
System.DateTime start = System.DateTime.Now;
ObjectTag slTag = Host.Local.FindSingle("pathToSLobjectTag");
System.DateTime intermediate = System.DateTime.Now;
Unknown slElment = slTag.FindSingle("pathToSLelementInApplication");
System.DateTime end = System.DateTime.Now;

TimeSpan timeToLoadWebPage = intermediate - start;
TimeSpan timeToLoadSLapp = end - intermediate;
Hope that makes things clearer :-)

Regards,
Alex
Ranorex Support Team
.
Image

thangavel
Posts: 50
Joined: Tue Jun 09, 2009 6:48 am
Contact:

Re: How to find SilverLight object's Load Time?

Post by thangavel » Wed Aug 05, 2009 3:12 pm

Thanks Alex.

I used find instead of FindSingle method. It is working. :)
Regards,
Thangavel.S