Can't access the controls in Silverlight Application

6 posts, 1 answers
  1. Sujeet
    Sujeet avatar
    4 posts
    Member since:
    Jun 2010

    Posted 21 Jun 2010 Link to this post

    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 ...........!

     

     

     

     

     

  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 21 Jun 2010 Link to this post

    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
  3. Sujeet
    Sujeet avatar
    4 posts
    Member since:
    Jun 2010

    Posted 22 Jun 2010 Link to this post

    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.

     
  4. Sujeet
    Sujeet avatar
    4 posts
    Member since:
    Jun 2010

    Posted 24 Jun 2010 Link to this post

    Is anybody have the solution for this............Pleeeeeeeeeeze..!
  5. Sujeet
    Sujeet avatar
    4 posts
    Member since:
    Jun 2010

    Posted 24 Jun 2010 Link to this post



    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...
  6. Answer
    Cody
    Admin
    Cody avatar
    3354 posts

    Posted 28 Jun 2010 Link to this post

    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
Back to Top