Monday, October 28, 2013

WatiN error: Could not load file or assembly 'Interop.SHDocVw’

For a customer I’m comparing multiple UI testing frameworks. One of these frameworks I’m looking at is WatiN.

I started simple, I created a new test project in Visual Studio, installed the required assemblies through NuGet and copied the sample code from the website.

But when I tried to run this test, it failed with the following error message:

Test Name:        TestMethod1

Test FullName: WatinTestProject.UnitTest1.TestMethod1

Test Source:      c:\Projects\Test\WatinTestProject\WatinTestProject\UnitTest1.cs : line 12

Test Outcome: Failed

Test Duration:   0:00:00,0910315

Result Message:             

Test method WatinTestProject.UnitTest1.TestMethod1 threw exception:

System.IO.FileNotFoundException: Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db7cfd3acb5ad44e' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.

The error indicated that the Interop.SHDocVw file could not be found, but when I took a look at the references, the file was correctly referenced. To solve the problem you have to go to the properties of this reference and change the Embed Interop Types property to False. This will copy the assembly to your bin folder and solve the issue.

3 comments:

Anonymous said...

Thanks!

Evan said...

Thank you!

Lena Selever said...

helped, thanks a lot!