Reputation: 999
Is there a way to simulate a right/left mouse click at a specific location on screen?
Not element#click
, but simply specify a location on screen ( 500 , 500 ) ?
Thanks.
Upvotes: 3
Views: 2223
Reputation: 4934
@browser.execute_script("$(document.elementFromPoint(x, y)).click();")
UPDATE
The trouble is it may not do what you expect from right click
@browser.execute_script("$(document.elementFromPoint(2, 2)).trigger({type: 'mousedown', which: 3});")
it might be not so much about watir webdriver solution but should work
Upvotes: 4