I briefly thought about just cribbing the functionality from WatiN and extending white's capabilities but quickly discarded that idea as too complicated and out of concern that it would become a maintenance nightmare.
The solution I came up with is to use WatiN and white together in a hybrid fashion, where WatiN spins up a browser instance and then white attaches to that browser instance using the ProcessID of the instance from WatiN. White doesn't expose an Attach method up in the InternetExplorer class where Launch lives, but it does have it down in White.Core on the Application class, so it was a simple matter to create an extension method on the InternetExplorer class to expose one that can be used in unit tests.
It goes a little like this (warning: horrible formatting):
public static class WhiteExtensions
{
// the extension method to simplify usage
public static InternetExplorerWindow Attach(
this InternetExplorer val, int processId, string title)
{
InternetExplorerFactory.Plugin();
return (InternetExplorerWindow)Application
.Attach(processId)
.GetWindow(title);
}
}
// new up a browser with WatiN
Watin.Core.IE watin = new Watin.Core.IE(url);
watin.Link(Find.ByText("foo")).Click();
// spin up white and attach to the browser that WatiN started
White.WebBrowser.InternetExplorer white = new White.WebBrowser.InternetExplorer();
white.Attach(watin.ProcessID, "browser window title");
// get the Silverlight app reference from the white browser reference
White.WebBrowser.Silverlight.SilverlightDocument sl = white.SilverlightDocument;
// do stuff
sl.Get<Button>(SearchCriteria.ByAutomationId("SomeButton")).Click();
UPDATE: screenshot of exactly how my working unit test code looks
