等待错误 ElementNotFoundException
当我尝试对我的网站运行单元测试时,我突然开始收到以下错误:
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)
测试以前没有问题地通过,所以我不确定为什么开始发生此错误。有人有什么建议吗? TIA。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上通过执行三个步骤解决了问题:1)更新了 URL,因为我的同事更改了它们。 2) 以管理员身份运行 Visual Studio。 3) 在 IE9 中,转到“工具”->“Internet 选项”->“安全”选项卡->“本地 Intranet”。单击站点按钮并删除“自动检测 Intranet 网络”复选框。感谢您的反馈!
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!
您现在可能使用不同的浏览器或不同的版本。您可以在以前可以工作的旧浏览器中测试它,看看它是否仍然有效?
it could be that you are now using a different browser, or a different version. Can you test it in the old browser where it used to work and see if it still works?