4

I am trying to do the quick start example, I bring in the ref's using NuGet in VS2010, I scrape the sample code on the webpage, I see my NUnit Session window, I click the green arrow, but the browser doesn't get invoked (doesn't start). What am I missing?

using System;  
using NUnit.Framework;  
using WatiN.Core;

namespace FirstWatinProject  
{  
    [TestFixture]  
    public class Class1  
    {  

        [Test]
        [STAThread]
        public void SearchForWatiNOnGoogle()
        {
            using (var browser = new IE("http://www.google.com"))
            {
                browser.TextField(Find.ByName("q")).TypeText("WatiN"); 
                browser.Button(Find.ByName("btnK")).Click(); 
                Assert.IsTrue(browser.ContainsText("WatiN"));
            }
        }

    }
}

I am getting the following error in NUnit Sessions window;

SearchForWaitOnGoogle Failed: System.IO.FileNotFoundException: Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral etc...

SteveC
  • 15,808
  • 23
  • 102
  • 173
dannyrosalex
  • 1,794
  • 4
  • 16
  • 25

5 Answers5

4

Okay, solved the error, it is as the following other overflow thread concludes; WatiN System.IO.FileNotFoundException Interop.SHDocVw

BUT, a key action in the sequence is to build the class library project AFTER setting the Interop.SHDocVw dlls' 'Embed Interop Types' property to 'False';

Then you can hit the green arrow in NUNIT Sessions window and you will see the IE browser startup after a second or two. Simply click it and you will see whatever actions you have programmed.

God is in the details!

Community
  • 1
  • 1
dannyrosalex
  • 1,794
  • 4
  • 16
  • 25
1

Setting the Interop.SHDocVw, Microsoft.mshtml dlls' 'Embed Interop Types' property to 'False';

Of course Visual Studio would give you warnings on how to amend.

The Use of Nugget Package Manager

gnat
  • 6,213
  • 108
  • 53
  • 73
0

Check for the availability of Interop.SHDocVw.dll, Make sure that your project has a reference to Interop.SHDocVw.dll and the dll is present in the Bin/Release Folder depending upon how you are running..

0

Just select Build from the main menu...then select Configuration Manager. In the list select you project and change its Plateform 'Any CPU' etc to x86.

If you have only Only CPU option, you can use ... option when chosing platform and create new setting, that is for X86 platform and then choose it.

ref: Change target to x86 in VS2010

Community
  • 1
  • 1
0

I already had a reference to Interop.SHDocVw. The easiest fix for me was simply changing .NET from 4.5 to 3.5 in Visual Studio settings. After making the change, it worked fine.

WiredEarp
  • 383
  • 3
  • 11