When I am attempting to run the unit tests against my website, I suddenly started receiving the following error:
WatiN.Core.Exceptions.ElementNotFoundException was unhandled by user code
Message=Could not find A element tag matching criteria: Attribute 'href' equals uri 'https://my.companyurl.com/client/clientupload.aspx' at https://my.companyurl.com/account/default.aspx
Source=WatiN.Core
StackTrace:
at WatiN.Core.Element.get_NativeElement()
at WatiN.Core.Element.GetAttributeValueImpl(String attributeName)
at WatiN.Core.Component.GetAttributeValue(String attributeName)
at WatiN.Core.Element.get_Enabled()
at WatiN.Core.Element.ClickImpl(Boolean waitforComplete)
at WatiN.Core.Element.Click()
at UnitTests.MyUploadFileClass.ClickNavigateToUploadFile() in D:\DevProjects\MyWebApp\test\UnitTests\Tests\MyUploadFileClass.cs:line 40
at UnitTests.MyUploadFileClassTest.UploadNewFileTest() in D:\DevProjects\MyWebApp\test\UnitTests\Tests\MyUploadFileClassTest.cs:line 110
InnerException:
Also receiving exceptions like this:
System.Runtime.InteropServices.COMException was unhandled by user code
Message=The interface is unknown. (Exception from HRESULT: 0x800706B5)
Source=Interop.SHDocVw
ErrorCode=-2147023179
StackTrace:
at SHDocVw.InternetExplorerClass.set_Visible(Boolean pBool)
at WatiN.Core.Native.InternetExplorer.IEBrowser.set_Visible(Boolean value)
at WatiN.Core.IE.FinishInitialization(Uri uri)
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor(String url)
The tests used to pass previously with no problem, so I’m not sure why this error started occuring. Does anyone have any suggestions? TIA.
Actually resolved the problems by performing three steps: 1) Updated the URLs because my coworker had changed them. 2) Ran Visual Studio as administrator. 3) In IE9 went to Tools->Internet Options->Security tab->Local Intranet. Clicked on the sites button and removed the check box from “Automatically detect intranet network”. Thanks for the feedback!