开发者

Mousemove in Watir

开发者 https://www.devze.com 2023-03-16 02:36 出处:网络
How do you simulate a mousemove event in watir? I have a mildly fancy object that开发者_JAVA技巧 cares about the exact position of the mouse within that object.If firing the javascript mouseover eve

How do you simulate a mousemove event in watir?

I have a mildly fancy object that开发者_JAVA技巧 cares about the exact position of the mouse within that object.


If firing the javascript mouseover event isn't specific enough...

browser.div(:id, "some-id").fire_event "onmouseover"

source: Mouse movement / mouseover and JavaScript evaluation in watir

...then you can try pairing Watir and autoit as described here to put the cursor in a specific location: http://www.autoitscript.com/autoit3/docs/functions/MouseMove.htm

browser.autoit.MouseMove(x,y)

If using Windows, Win32ole will also make use of autoit. There's a lot of this action documented in the 'how to handle pop-ups' section of the Watir FAQ. http://wiki.openqa.org/display/WTR/Pop+Ups

require 'win32ole'
a=WIN32OLE.new("AutoItX3.Control")
a.mousemove 100,100
a.mousemove 300,300
a.mouseclick "right"

source: http://groups.google.com/group/watir-general/browse_thread/thread/4fa59dc4a33c58dd/451d5b72e5c37c63?lnk=gst&q=autoit+mousemove#451d5b72e5c37c63

0

精彩评论

暂无评论...
验证码 换一张
取 消