Mouse movement / mouseover and JavaScript evaluati

2019-05-14 19:13发布

I have a JavaScript-heavy Rails app which I am testing in watir. I have two specific testing requirements:

  • I need to be able to simulate moving the mouse to a specific area of the screen (or at least triggering the onmouseover event for a div)
  • Evaluating a snippet of JavaScript once the above has happened to see if a flag is set correctly

I haven't been able to figure out how to do this in watir. Any ideas on how to do this?

2条回答
我命由我不由天
2楼-- · 2019-05-14 19:40

You can look at the following page for mouse controls:

http://wiki.openqa.org/display/WTR/Right+Click+an+Element

查看更多
霸刀☆藐视天下
3楼-- · 2019-05-14 19:42

For the first question:

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

I have no idea how to solve the second question. You could ask at watir-general.

查看更多
登录 后发表回答