This is a migrated thread and some comments may be shown as answers.

Testing Silverlight using DOM model

7 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
k
Top achievements
Rank 1
k asked on 09 Jun 2010, 12:13 PM
Hello!

I am new in Web.Aii
I need to learn to test Silverlight applications.


E.g., I want to click on some square at http://www.brightstarr.com/US/Pages/default.aspx

I use such code:
Manager.ActiveBrowser.NavigateTo("http://www.brightstarr.com/US/Pages/default.aspx");
            Manager.ActiveBrowser.WaitUntilReady();
            System.Threading.Thread.Sleep(6000);
            SilverlightApp app = Manager.ActiveBrowser.SilverlightApps().First();
            app.FindName<Button>("autoUpgrade").User.Click();
            
But it does not work. web.Aii just can't find element to click.
Can anybody halp me and tell what to do?

Code of the square in HTML code:
<object height="100%" width="100%" type="application/x-silverlight-2" data="data:application/x-silverlight,">
<param value="../../../Documents/Silverlight/WebAnimationsusa.xap" name="source" id="ctl00_ctl22_g_57f12b59_9d07_49b9_8715_ce29bec40605_ctl00_src"/>
<param value="onSilverlightError" name="onerror"/>
<param value="white" name="background"/>
<param value="3.0.40818.0" name="minRuntimeVersion"/>
<param value="true" name="autoUpgrade"/>
<param value="true" name="windowless"/>
<a style="text-decoration: none;" href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40818.0">
    
<img value="http://go.microsoft.com/fwlink/?LinkId=108181" style="border-style: none;" 
alt="Get Microsoft Silverlight" id="ctl00_ctl22_g_57f12b59_9d07_49b9_8715_ce29bec40605_ctl00_img" src="http://go.microsoft.com/fwlink/?LinkId=108181"/>

</a>
</object>

7 Answers, 1 is accepted

Sort by
0
Missing User
answered on 09 Jun 2010, 10:07 PM
Hello k,

Can you post back with what error message you are getting when running your test? And just to make sure, please have Settings.EnableSIlverlight = true in your test code.
 
From the html code you posted, the following property is not currently supported:

<param value="true" name="windowless"/>

There maybe other things you can try, but please reply back with the error message you are getting.

All the best,
Nelson Sin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
k
Top achievements
Rank 1
answered on 10 Jun 2010, 05:06 AM
Thanks for answer.


Code is:
Manager.ActiveBrowser.NavigateTo("http://www.artoftest.com/Samples/SampleApplication.html");
            Manager.ActiveBrowser.WaitUntilReady();
            System.Threading.Thread.Sleep(6000);
            SilverlightApp app = Manager.ActiveBrowser.SilverlightApps().First();
            Assert.IsNotNull(app);
            TextBox name1 = app.Find.ByName<TextBox>("name1");

Error Stack Trace is:
SearchUsingNonHierarchialMatch(ITargetElement startNode, IList`1 clauses, V expression, Boolean ignoreConstraints)
Find(T startNode, IList`1 clauses, V expression, Boolean includeRoot, Boolean ignoreContraints)
ByExpression(T startNode, V expression, Boolean includeRoot)
ByExpression(V expression)
ArtOfTest.WebAii.Silverlight.VisualFind.ByName(String name)
ArtOfTest.WebAii.Silverlight.VisualFind.ByName[T](String name)
ETR.VM.Silverlight.Silverlight1() in C:\ETR.WebAii\ETR.VM\Silverlight.cs: line 190


and Web.Aii settings are:
<WebAii.Settings
     annotateExecution="true"
     annotationMode="All"
     aspNetDevServerPort="-1"
     clientReadyTimeout="110000"
     createLogFile="true"
     logAnnotations="true"
     logLocation="C:\WebAiiLogs\"
     defaultBrowser="InternetExplorer"
     enableScriptLogging="false"
     enableSilverlight="true"
     enableUILessRequestViewing="false"
     executionDelay="3000"
     executionTimeout="110000"
     killBrowserProcessOnClose="false"
     localWebServer="None"
     queryEventLogErrorsOnExit="true"
     recycleBrowser="false"
     scriptLoggingPort="8099"
     simulatedMouseMoveSpeed="0.3"
     waitCheckInterval="500"
     webAppPhysicalPath="C:\Aot\webtest\artoftest.testing\pages"
     useHttpProxy="false"
     verboseHttpProxy="false"

0
Missing User
answered on 10 Jun 2010, 11:14 PM
Hi again k,

So I tested out the example page again and it worked for me without the error you mentioned. I would highly recommend you use the WebAii templates in a Visual Studio Test Project by:

Right clicking on your test project -> Add... -> New Item... -> expand Test node -> WebAii 2010.1

The code that I got working in the VsUnit template was just:

Manager.LaunchNewBrowser();
ActiveBrowser.WaitUntilReady();
System.Threading.Thread.Sleep(6000);
SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
Assert.IsNotNull(app);

Please try applying the WebAii Templates to the Sample page and also on your own SL application.

Regards,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
k
Top achievements
Rank 1
answered on 11 Jun 2010, 05:38 AM
There's no Web.Aii 2010.1 :(
See screen shot attached, there's all I see.

Could you please suggest where can I download Web.Aii 2010.1?

0
Konstantin Petkov
Telerik team
answered on 11 Jun 2010, 07:54 AM
Hello,

The test template from your screen shot (WebAii 2.0) will also work. It may look a bit different in different version so sorry for the confusion.

You can find more about the template in the documentation here. Please give the VsUnit template a go and let us know if you need further assistance.

All the best,
Konstantin Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
k
Top achievements
Rank 1
answered on 11 Jun 2010, 12:25 PM
I use VSUnit template.
Test is still fails on line        TextBox name1 = app.Find.ByName<TextBox>("name1");

Could it be something wrong with my browser settings?

And could somebody explain why field name is name1  in such example http://www.artoftest.com/Samples/SampleApplication.html??
Are there another ways to find elements??
Can you give examples of code for this page?
    
         Remind, that my initial code was:   
            Manager.LaunchNewBrowser();
            Manager.ActiveBrowser.NavigateTo("http://www.artoftest.com/Samples/SampleApplication.html");
            Manager.ActiveBrowser.WaitUntilReady();
            System.Threading.Thread.Sleep(6000);
            SilverlightApp app = Manager.ActiveBrowser.SilverlightApps().First();
            Assert.IsNotNull(app);
            TextBox name1 = app.Find.ByName<TextBox>("name1");
0
Missing User
answered on 11 Jun 2010, 08:37 PM
Hi again k,

Thanks for trying the VS template. For some reason Manager.ActiveBrowser.SilverlightApps().First(); is not working. Please try Manager.ActiveBrowser.SilverlightApps()[0];

Regards,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
k
Top achievements
Rank 1
Answers by
Missing User
k
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Share this question
or