A fully-automated testing rig #7
Nathan Page
##Part 7: When this.mouse.click doesn't work
mouse.click and mouse.move are a really helpfuls function in CasperJS, but we have at times found that they just don't work. Mostly, that's been because the element isn't there to click on. Do make sure that it's actually there! Make sure you're using the right selector, too. Try a casper.capture() to see whether it's there, but be wary of timings to ensure that you get a capture for the moment that you want to be performing the mouse action.
If all else fails, and in one test script nothing at all would work, then just use jQuery. It's available natively in the site we're working on anyway, though you can import it if you need to.
Something like this might help get the job done:
casper.then->
test.evaluate->
jQuery("path:nth-child(2) span").mouseover()
#####Dropdowns
It's worth noting that dropdowns, in general, don't work with this form of 'fake' mouse interaction. CasperJS' click action only really moves a pretend cursor inside a virtual browser, and can't actually provide a 'genuine' mouse click. The same applies to jQuery, though jQuery has ways of making most other interactions work.
We've been using custom dropdowns a lot in this project, for which mouse interaction doesn't work at all. The only way around most of this has been to fill and submit the form manually.