TestDriven.Net を使用して、VS2010 の MSpec で WatiN を動作させようとしています。私のコードは次のとおりです。
[Subject("Whatever")]
public class when_on_home_page {
private static IE browser;
Establish context = () =>
browser = new IE();
Because of = () => {
browser.GoTo("http://localhost:1234/");
browser.WaitForComplete();
};
It should_show_add_details_link = () =>
browser.Link(Find.ByValue("Add Details")).Exists.ShouldBeTrue();
}
これを実行すると、ブラウザーはページをロードしますが、リンクをチェックすると、次のようになります。
何でも、ホームページにあるとき
»詳細の追加リンクを表示する必要があります(FAIL)「詳細リンクの追加を表示する必要がある」というテストに失敗しました: System.UnauthorizedAccessException: アクセスが拒否されました。(HRESULT からの例外: 0x80070005 (E_ACCESSDENIED)) WatiN.Core.Native.InternetExplorer.IEElementCollection.GetElementsByTag(String tagName) の WatiN.Core.NativeElementFinder.FindElementsByTag(String tagName) の mshtml.IHTMLElementCollection.tags(Object tagName) で.Core.NativeElementFinder.d__2.MoveNext() at WatiN.Core.ElementFinder.FindFirst() at WatiN.Core.Element.FindNativeElementInternal() at WatiN.Core.Element.get_Exists() NavigationSpecs.cs(20,0): at RoboWeb.Specs.when_on_home_page.<.ctor>b__2() で Machine.Specifications.Model.Specification.InvokeSpecificationField() で Machine.Specifications.Model.Specification.Verify()
ざっと見たところ、以下の点を確認しました。
- VS は管理者として実行されています
- TestDriven.Net はすべてを STA モードで実行するようです。
- IE の「保護モード」がオフになっている
- おそらくローカルで実行されているため、サイトを信頼済みサイトに追加できません
- WaitForComplete() を呼び出し、Thread.Sleep() も試しました
FireFoxでも試してみましたが、クラッシュするだけです。
ここで何が間違っているのか分かりますか?