如何让WatiN在Windows Server 2008上使用IE8? [英] How do you get WatiN to work on Windows Server 2008 with IE8?

查看:177
本文介绍了如何让WatiN在Windows Server 2008上使用IE8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我无法通过简单的WatiN测试来可靠地运行我的运行Windows Server 2008和IE8的开发机器。

My problem is that I cannot get a simple WatiN test to reliably work on my development machine which is running Windows Server 2008 and IE8.

我见过一对关于此的好帖子,但我仍然有问题。以下是帖子:

I have seen a couple of good posts on this, but am still having problems. Here are the posts:

  • MSDN Testing Article
  • Stack Overflow - WatiN Second Method Fails

第一篇文章似乎有帮助(在我的hosts文件中注释掉:: 1,将我的网站放在可信站点中,并确保我的app.config有STA并设置为copy if new,但他们没有帮助可靠。我尝试了第二个例子中的代码,希望它会有所帮助,但事实并非如此。我使用的是WatiN 2.0版测试版。

The steps in the first article seemed to help (comment out "::1" in my hosts file, put my site(s) in trusted sites, and making sure my app.config has "STA" and is set to "copy if newer", but they did not help reliably. I tried the code from the second example hoping that it would help but it did not. I am using WatiN version 2.0 beta 1.

My NUnit代码如下所示:

My NUnit code looks like the following:

protected Browser Browser { get; set; }

[TestFixtureSetUp]
public void SetupPriorToTestsInThisFixture()
{
    Browser = new IE();
    Browser.GoTo(Constants.SiteCollectionUrl);
}

[TestFixtureTearDown]
public void TearDownAfterTestsInThisFixture()
{
    if (Browser != null)
    {
        Browser.Dispose();
    }
}

[Test]
public void WaterThroughThePipes()
{
    Link link = Browser.Link(Find.ByText("Calendar"));
    bool exists = link.Exists;
    Assert.That(exists, Is.True, "Could not find 'Calendar' link.");
}

我所看到的是有时(虽然很少)我的测试通过。有时断言失败(exists = false),有时我在尝试打开浏览器时会出现超时,有时我在尝试访问link.Exists时出错。

What I'm seeing is that sometimes (albeit rarely) my test passes. Sometimes the assertion fails (exists = false), sometimes I get a timeout when trying to open the browser, and sometimes I get an error trying to access link.Exists.

访问link.Exists的错误如下所示:

The error accessing link.Exists looks like:


MyFixture.WaterThroughThePipes:
System.Runtime.InteropServices.COMException:接口是未知。 (HRESULT异常:0x800706B5)

MyFixture.WaterThroughThePipes: System.Runtime.InteropServices.COMException : The interface is unknown. (Exception from HRESULT: 0x800706B5)

我现在似乎无法重现超时错误所以我无法在片刻(尽管过去常常发生这种情况)。

I can't seem to reproduce the timeout error now so I can't provide that at the moment (although this used to happen all of the time).

在调试模式下运行时,我倾向于看到不同的结果,而不是在调试模式下运行。

I tend to see different results when running this in debug mode vs. not running in debug mode.

对于它的价值,Firefox 3.0.6从未为我工作过。我喜欢它,但需要IE无论如何工作。这是我在Firefox中遇到的错误。

For what it's worth, Firefox 3.0.6 has never worked for me. I'd like it to, but need IE to work regardless. Here is the error I get with Firefox.


MyFixture(TestFixtureSetUp):
WatiN.Core.Native.Mozilla.FireFoxException:无法连接到jssh服务器,请确保您已正确安装jssh.xpi插件
----> System.Net.Sockets.SocketException:无法建立连接,因为目标计算机主动拒绝它127.0。 0.1:9997

MyFixture (TestFixtureSetUp): WatiN.Core.Native.Mozilla.FireFoxException : Unable to connect to jssh server, please make sure you have correctly installed the jssh.xpi plugin ----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it 127.0.0.1:9997

有什么想法吗?我真的不想回到Selenium(去过那里,做过那个),但我可能不得不这样做。

Any ideas? I really don't want to go back to Selenium (been there, done that), but I may have to.

推荐答案

以管理员身份运行Visual Studio

Run Visual Studio as Administrator

这篇关于如何让WatiN在Windows Server 2008上使用IE8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆