The sample Silverlight UI automation codes doesn't work

Jun 8, 2010 at 3:03 PM

Hello,  I was working on the sample codes to automate SL UI testing @ http://white.codeplex.com/wikipage?title=Silverlight&referringTitle=Home for days.  My codes is here:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using White.WebBrowser;
using White.WebBrowser.Silverlight;
using White.Core;
using White.Core.UIItems;

namespace ConsoleApplicationWhite
{
    class Class1
    {
        static void Main(string[] args)
        {
            InternetExplorerWindow browserWindow = InternetExplorer.Launch("http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight/Silverlight3_DragAndDrop/Example.aspx", "Test Page for SilverlightDesktopTest - Microsoft Internet Explorer");
            
            SilverlightDocument document = browserWindow.SilverlightDocument;
            TextBox nameBox = document.Get<TextBox>("nameBox");
            TextBox passwordBox = document.Get<TextBox>("passwordBox");

            Button button = document.Get<Button>("OKButton");
            button.Click();
        }
    }
}

 

When executing the first line, it gives me an error:

An unhandled exception of type 'System.TypeInitializationException' occurred in White.Core.dll

Additional information: The type initializer for 'White.Core.Desktop' threw an exception.

 

There is my app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="NUnit">
      <section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
      <section name="ProgramMode" type="Debug"/>
    </sectionGroup>
    <sectionGroup name="White">
      <section name="Core" type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
    <sectionGroup name="Bricks">
      <section name="Bricks" type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
  </configSections>

  <White>
    <Core>
      <add key="WorkSessionLocation" value="." />
      <add key="PopupTimeout" value="10000" />
      <add key="SuggestionListTimeout" value="3000" />
      <add key="BusyTimeout" value="10000" />
      <add key="WaitBasedOnHourGlass" value="true" />
      <add key="UIAutomationZeroWindowBugTimeout" value="5000" />
      <add key="TooltipWaitTime" value="3000" />
      <add key="DragStepCount" value="4" />
    </Core>
  </White>
  <Bricks>
    <Bricks>
      <add key="RecheckDurationInMilliseconds" value="101" />
    </Bricks>
  </Bricks>
</configuration>

I think this config file is also typical.

Any help is highly appreciated!