Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
601 views
in Technique[技术] by (71.8m points)

internet explorer 8 - How do you get WatiN to work on Windows Server 2008 with 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:

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 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.");
}

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.

The error accessing link.Exists looks like:

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.

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 : 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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Run Visual Studio as Administrator


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...