首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WatiN错误ElementNotFoundException

WatiN错误ElementNotFoundException
EN

Stack Overflow用户
提问于 2011-08-27 02:21:28
回答 2查看 2.9K关注 0票数 1

当我尝试对我的网站运行单元测试时,我突然开始收到以下错误:

代码语言:javascript
复制
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: 

还会收到类似如下的异常:

代码语言:javascript
复制
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)

以前的测试都是通过的,没有任何问题,所以我不确定为什么会出现这个错误。有人有什么建议吗?蒂娅。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-10-05 23:24:08

实际上通过执行三个步骤解决了问题: 1)更新了URL,因为我的同事已经更改了它们。2)以管理员身份运行Visual Studio。3)在IE9中,进入“工具”->“互联网选项”->“安全”选项卡->“本地内部网”。单击“站点”按钮,并从“自动检测intranet网络”中删除复选框。感谢您的反馈!

票数 2
EN

Stack Overflow用户

发布于 2011-08-27 03:13:32

可能是您现在使用的是不同的浏览器,或者是不同的版本。你能在它曾经工作过的旧浏览器中测试它,看看它是否还能工作吗?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7208982

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档