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

What happens if there are multiple nested silverlight control?

7 Answers 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John Delizo
Top achievements
Rank 2
John Delizo asked on 24 Sep 2009, 06:03 AM
My page contains multiple parent silverlight applications. each parent has child user controls that has also its own child usercontrols. each "grand-children" (SLUserControlLibrary) user controls is where the actual silverlight controls are found.

PAGE
    |
    + SLAPP
               |
               +SLUserControl
                                         |
                                        + SLUserControlLibrary
                                                                            |
                                                                            +SilverLightControls
                                                                            +textbox (id="txtID500")                                                                            |
                                
My question would the WebAii SilverLight Test Automation will be able to find the controls underneath all of those nesting of user controls? or in the above illustration, can I find the textbox id=txtID500 ?

Can I still do this?

 

var SilverLightApp1 = ActiveBrowser.SilverlightApps()[0];

 

 

var txtbox500 = SilverLightApp1.FindName("txtbox500");

 

 

txtbox500.User.TypeText("Sample Text", 10);

Thanks!

 

7 Answers, 1 is accepted

Sort by
0
Missing User
answered on 24 Sep 2009, 03:52 PM
Hello John,

I asked a co-worker, and he said the test code should work as long as you are finding the right Silverlight app on the page. I'll also run though the scenario just to make sure.

Best wishes,
Nelson
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
John Delizo
Top achievements
Rank 2
answered on 28 Sep 2009, 01:07 AM
Thank you for your reply on this thread. Another question is that, what if there are 2 controls have the same ID? Because its nested user controls, its possible that this may occur.
0
John Delizo
Top achievements
Rank 2
answered on 28 Sep 2009, 01:10 AM
Quoting this: "test code should work as long as you are finding the right Silverlight app on the page"

Would I count the user controls as a silverlight app or I would refer to the parent container?
Does the test framework supports parent-child tree traversing? (Ex. is that I refer to an element ID and to get its parent) Is this the way I should be doing it?
0
Missing User
answered on 28 Sep 2009, 08:20 PM
Hi again John,

I tested this scenario out and the framework is able to find the nested TextBox by name. Also, using SilverlightApp.Find.AllByName<TextBox>("txtbox500") returned the nested TextBox and the standalone instance of TextBox with the same name.

If I understand your question correctly, you can access the User Control via Framework f = SilverlightApp.Find... and the element contains it's children in a collection, with the children having children, etc. You may want to try to use the SilverlightApp.Find methods though, as they are probably more convenient than going through all the children.

Sincerely yours,
Nelson
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
John Delizo
Top achievements
Rank 2
answered on 29 Sep 2009, 06:21 AM
Thank you!
How about what if there are 2 controls have the same ID? Because its nested user controls, its possible that this may occur question?
0
Missing User
answered on 29 Sep 2009, 05:11 PM
Hello again John,

I guess I wasn't sure about the nested user control structure you are talking about with the same IDs/Names.

I base my last answer on your previous post where a custom control contains a TextBox and a seperate instance of a TextBox with the same ID/Name exists on the page by itself. The SilverlightApp.Find.AllByName<TextBox>("txtbox500") line was the what would find both controls based on that scenario.

Could you provide an illustration of your latest question?

All the best,
Nelson
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Faris
Top achievements
Rank 1
answered on 01 Oct 2009, 12:47 AM
Hi John -

The WebAii Framework supports nested controls and supports the ability to find multiple controls with the same ID/Names..etc. To help aid with discovering controls with the same ID/Name, the Framework supports nested Finds. (i.e. Find Control A then Search only under Control A for Control B). This allows you to constraint searches within certain nodes under the tree. That helps a lot when dealing with complex control structures in Silverlight with different namescopes.

Each FrameworkElement object has a Find object associate with it that you can use to search under that node only. 

FrameworkElement.Find.ByName();

I would like to also point you to the following example that demonstrates this: http://www.artoftest.com/community/blogs/09-05-14/Automating_Real_World_Silverlight_Apps.aspx

Tags
General Discussions
Asked by
John Delizo
Top achievements
Rank 2
Answers by
Missing User
John Delizo
Top achievements
Rank 2
Faris
Top achievements
Rank 1
Share this question
or