当我尝试对我的网站运行单元测试时,我突然开始收到以下错误:
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: 还会收到类似如下的异常:
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)以前的测试都是通过的,没有任何问题,所以我不确定为什么会出现这个错误。有人有什么建议吗?蒂娅。
发布于 2011-10-05 23:24:08
实际上通过执行三个步骤解决了问题: 1)更新了URL,因为我的同事已经更改了它们。2)以管理员身份运行Visual Studio。3)在IE9中,进入“工具”->“互联网选项”->“安全”选项卡->“本地内部网”。单击“站点”按钮,并从“自动检测intranet网络”中删除复选框。感谢您的反馈!
发布于 2011-08-27 03:13:32
可能是您现在使用的是不同的浏览器,或者是不同的版本。你能在它曾经工作过的旧浏览器中测试它,看看它是否还能工作吗?
https://stackoverflow.com/questions/7208982
复制相似问题