This project is read-only.

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 @ 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("", "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");


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" ?>
    <sectionGroup name="NUnit">
      <section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
      <section name="ProgramMode" type="Debug"/>
    <sectionGroup name="White">
      <section name="Core" type="System.Configuration.NameValueSectionHandler"/>
    <sectionGroup name="Bricks">
      <section name="Bricks" type="System.Configuration.NameValueSectionHandler"/>

      <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" />
      <add key="RecheckDurationInMilliseconds" value="101" />

I think this config file is also typical.

Any help is highly appreciated!