WebDriver mouse actions on Canvas

28 views
Skip to first unread message

Aaron Mulder

unread,
May 9, 2013, 10:57:24 AM5/9/13
to webd...@googlegroups.com
I'm trying to use WebDriver on a page with a Canvas, and I need to be
able to use precision mouse events on the Canvas for move, click, etc.

I'm having trouble getting this to work. For instance, when I use this code:

new Actions(driver).moveToElement(canvas, 247, 433).click().perform();

Then I get this sequence of events (with coordinates relative to the canvas):

mousemove at 247,433
mousemove at 350,300
mousedown at 350,300
mouseup at 350,300
click at 350,300

I was expecting to see all the actions happen at 247,433 but instead
everything after the initial move is happening at the center of the
Canvas (which is size 700x600 so center 350,300). The API for click()
says it will happen at the "current mouse location" but that doesn't
seem to be happening.

For what it's worth I'm using Firefox on OS X with WebDriver 2.32.0

Thanks,
Aaron
Reply all
Reply to author
Forward
0 new messages