I’m playing with a grails app that has a contextmenu (on right-click).
The context menu is built using Chris Domigan’s jquery contextmenu plugin.
While the contextmenus do actually work, I want to have automated tests, and I can’t work out how to do it.
- I’ve tried Selenium 2.05a (ie. Webdriver), but there’s no rightClick method.
- I notice that HtmlUnit has a rightclick method, but I don’t seem to be able to detect any difference in the DOM between before the click and after it.
While I’d like to be able to do it in Internet Explorer or Firefox as well, the main usage will be HtmlUnit. It’s nice that the HtmlUnit HtmlElement has a
rightClick()method, but unfortunately it’sprotectedand so not accessible from the WebDriver wrapped HtmlUnitWebElement.I wrote a hack to make it accessible, and so now I can call rightClick(), although it only works if it’s running with HtmlUnit – not IE or FF.
Now my (groovy) test looks like this: