When testing with WatiN: “'DebuggerDisplayProx

2019-07-28 02:45发布

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

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

The HTML on the page is:

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

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()' threw an exception of type 'System.InvalidCastException'

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?

标签: watin
2条回答
仙女界的扛把子
2楼-- · 2019-07-28 03:04

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

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

查看更多
手持菜刀,她持情操
3楼-- · 2019-07-28 03:29

Can you try the following code:

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

I'm pretty sure that it doesn't like the link being JavaScript:...

Edit: Try maybe this:

CurrentBuyerSite.Eval("ShowMenuItem('options','actions'); ...");
查看更多
登录 后发表回答