WATIN simulating right button click in Firefox

2019-08-02 14:03发布

I use the following code to simulate right button click

NameValueCollection eventProperties = new NameValueCollection(); eventProperties.Add("button", "2"); box.FireEvent("onmousedown", eventProperties);

they work well in IE, but does not work in Firefox, Firefox still recognize the click as left (0) button button.

Thanks

标签: firefox watin
2条回答
2楼-- · 2019-08-02 14:28

I've come up against this as well. It will probably be seen to within WatiN but I did find a workaround.

The workaround is not great as it involves a local variable to give the tests a hook. Test sets variable, and then right click checking code either works to

button == 2 || testHook == 1

Not pretty but it seems like a tricky one until the framework is updated.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-08-02 14:32

See my answer to solve this for FireFox here. This needs to be fixed in WatiN though.

Jeroen

查看更多
登录 后发表回答