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

Can't access the controls in Silverlight Application

5 Answers 118 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sujeet
Top achievements
Rank 1
Sujeet asked on 21 Jun 2010, 06:35 AM

I trying to automate the Silverlight UI, It contains the tab structure the change tile textbox is in bydefault selected Tab ,  I am  trying to access it (see the last line in test code which is Bold throws Exception.) but it throwing some exception the eeor messgae is as below

Exception thrown during the wait for a condition. Error: Unexpected error while waiting on condition.
Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at ArtOfTest.WebAii.Silverlight.VisualWait.WaitForExistsByFindInfo(VisualFindInfo findInfo)
   at ArtOfTest.Common.WaitAsync._worker_DoWork[T,V](Object waitParam)


My Xaml file code snippet is like below

 

<TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource TitleTextBlockStyle}"><Run Text="Change Title"/></TextBlock>

<TextBox x:Name="txt_Essentials_ChangeTitle" Grid.Row="0" Grid.Column="2" Margin="2">

 

</TextBox>

 

 

Below is my Test Code:

 

Settings mySettings = new Settings(BrowserType.InternetExplorer, @"D:\log\");

 

 

 

Manager myManager = new Manager(mySettings);

 

 

myManager.Start();

myManager.LaunchNewBrowser();

myManager.ActiveBrowser.NavigateTo("

http://ApplicationURL");

 

 

myManager.ActiveBrowser.WaitUntilReady();

 

SilverlightAppsList slvrApp = myManager.ActiveBrowser.SilverlightApps();

 

 

 

SilverlightApp app = slvrApp.GetApp(0);

 

 

app.FindName<

TextBox>("txt_Essentials_ChangeTitle").Text = "ArtOfTest did the trick";


Please Suggest me the solution I am stucked up here ...........!

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 21 Jun 2010, 08:25 PM
Hello Sujeet,

It appears you are missing the step to enable Silverlight automation. Please modify your startup with this:

Settings mySettings = new Settings(BrowserType.InternetExplorer, @"D:\log\");
mySettings.EnableSilverlight = true;
Manager myManager = new Manager(mySettings);

Which line of code is throwing the NulReferenceException?

All the best,
Cody
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
Sujeet
Top achievements
Rank 1
answered on 22 Jun 2010, 05:03 AM
Hello Cody,


Still I am getting the same Exception,The following line throwing the Exception

app.FindName<TextBox>("txt_Essentials_ChangeTitle").Text = "ArtOfTest did the trick";

Pleeeeeeease help me, Thanx in advance.

 
0
Sujeet
Top achievements
Rank 1
answered on 24 Jun 2010, 05:16 AM
Is anybody have the solution for this............Pleeeeeeeeeeze..!
0
Sujeet
Top achievements
Rank 1
answered on 24 Jun 2010, 12:37 PM


Hey I have got the Solution, I just added the below line before Navigating to URL, and it works.

 

 myManager.LaunchNewBrowser();     
 myManager.ActiveBrowser.WaitUntilReady();     
 
 myManager.ActiveBrowser.ClearCach(BrowserCacheType.TempFilesCache);     
                    
 myManager.ActiveBrowser.NavigateT("ApplicationURL");    
 


Is it mandetory to add this line,any way its workin fine now...
0
Accepted
Cody
Telerik team
answered on 28 Jun 2010, 06:00 PM
Hi Sujeet,

Sorry I couldn't get back to you earlier. I'm glad you found a solutiion!

Adding the ClearCache call normally is not necessary. Sometimes it does help connecting to and automating Silverlight application. I guess it was needed in your case. Usually the ClearCache call only clears up a "Unable to connect to Silverlight application" symptom.

Sincerely yours,
Cody
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
Sujeet
Top achievements
Rank 1
Answers by
Cody
Telerik team
Sujeet
Top achievements
Rank 1
Share this question
or