-->

WATIN simulating right button click in Firefox

2019-08-02 14:14发布

问题:

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

回答1:

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.



回答2:

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

Jeroen



标签: firefox watin