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

Silverlight: Textbox Behavior Prevents Automation

1 Answer 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top Gun
Top achievements
Rank 1
Top Gun asked on 20 Aug 2012, 11:21 PM
I have a simple Silverlight OOB application.  The app opens with three textboxes: First Name, Last Name, and Age.  The Age textbox has a behavior associated with it.  This behavior forces the user to enter a valid number.  When I create a test using Test Studio, I record entry of a first name, last name and entry of an age into the form.  However, when I play the test back, all the textboxes get the proper values entered except for the age textbox.  If I remove the behavior from the Age textbox, then I can successfully play my test back and all the textboxes are populated correctly.  Is there a way to run this test successfully when the Age textbox has a behavior attached?  My Silverlight source code is attached.

1 Answer, 1 is accepted

Sort by
0
Top Gun
Top achievements
Rank 1
answered on 23 Aug 2012, 02:14 PM
I figured it out. I wrote a coded step.  The coded step allows a valid number to be entered into the Age textbox.  The coded step  is below.


Settings.Current.Web.EnableSilverlight = true;
SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
app.FindName<Telerik.WebAii.Controls.Xaml.RadMaskedTextBox>("txtAge").Text = "35";

Tags
General Discussions
Asked by
Top Gun
Top achievements
Rank 1
Answers by
Top Gun
Top achievements
Rank 1
Share this question
or