Mouse movement / mouseover and JavaScript evaluation in watir

两盒软妹~` 提交于 2019-12-22 09:21:22

问题


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?


回答1:


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.




回答2:


You can look at the following page for mouse controls:

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



来源:https://stackoverflow.com/questions/2421095/mouse-movement-mouseover-and-javascript-evaluation-in-watir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!