使用 WatiN 进行测试时:“'DebuggerDisplayProxy()' 引发了类型为 'System.InvalidCastException'"的异常 [英] When testing with WatiN: "'DebuggerDisplayProxy()' threw an exception of type 'System.InvalidCastException'"

查看:35
本文介绍了使用 WatiN 进行测试时:“'DebuggerDisplayProxy()' 引发了类型为 'System.InvalidCastException'"的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FrameworkActionsLink = CurrentBuyerSite.BuyerWorkAreaFrame.Link(Find.ById("actions"));

我有通过 ID 查找链接元素的代码.

I have code which finds a link element by finding by ID.

页面上的 HTML 是:

The HTML on the page is:

<a id="actions" href="Javascript:ShowMenuItem('options','actions'); ... >

我在您看到..."的 href 中排除了完整的 Javascript 代码.

I have excluded the full Javascript code in the href where you see "...".

在测试执行时,有时此代码可以正常工作,但有时会出现以下错误:

On test execution, sometimes this code works correctly, but sometimes I get the following error:

'DebuggerDisplayProxy()' 抛出类型异常'System.InvalidCastException'

'DebuggerDisplayProxy()' threw an exception of type 'System.InvalidCastException'

这是一段非常简单的代码,我只是想知道是否有人遇到过类似的问题或错误消息.您认为这是 WatiN 工具、Web 应用程序、Internet 浏览器的问题,还是其他问题?

It's a pretty straightforward bit of code, I just wondered if anyone had experienced similar problems or error messages. Do you think this is an issue with the WatiN tool, the web application, the internet browser, or perhaps something else entirely?

推荐答案

您使用的是什么跑步者?如果 nUnit 64 位然后尝试 32 位或其他赛跑者.

What runner are you using? if nUnit 64bit then try 32bit or other runner.

也许问题是页面没有完全下载,导致javascript功能出现问题,尝试将Click()替换为ClickNoWait().

Maybe the issue is that page didn't fully download and that makes problem with javascript function, try replace Click() for ClickNoWait().

这篇关于使用 WatiN 进行测试时:“'DebuggerDisplayProxy()' 引发了类型为 'System.InvalidCastException'"的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆