当我试图与我的网站运行单元测试,我突然开始收到以下错误:使用华廷错误ElementNotFoundException
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)
测试:
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:
也受到异常喜欢这个以前通过没有问题,所以我不知道为什么这个错误开始发生。有没有人有什么建议? TIA。
将页面HTML粘贴到此处,听起来好像您没有使用您正在寻找的URI的锚标签 – Jason