Is it possible to simulate hovering over a browser element?


Is there a way to simulate a mouseover / hover operation with ORQA?

Long version: I am automating a web application and there is a lookup control which contains an [input] element if empty and a [ul] (with a single [li] child and nested [button] to delete that child) if populated. A simplified representation would be:

Empty: div input /div
Populated: div ul li button /li /ul /div

The elements to lookup possible values are only active if the control has focus, which is fine if there is no current value, as I can click on the empty [input] element, the relevant elements become visible and all is well.

When I want to change an existing value, the control no longer has an [input] so I can’t click into it to set focus and use the lookup - if I click on any part of the control, the browser takes that as a click on the [li] (which contains a link) and navigates elsewhere. I need to delete the existing value first (to get the [input] element back) but the [button] to delete the existing value only displays if I hover the mouse cursor over the control, or give it focus in some other way that will convince the CSS to make it active. If I run an ORQA task to press the [button], it times out after about 5 seconds without finding the element unless I move the mouse over the control manually, at which point the CSS shows the [button] in the browser and ORQA finds and clicks it.

I’m using ORQA 1.4.0 build 423 with Chrome.


Hi James,

There’s no operation currently for simulating mouse hover over a web element, but I can raise a ticket to get a hover operation added.

In the meantime, depending on the behavior of the widget, you might be able to trigger it’s editor by sending a keystroke to the relevant div with the ‘press key’ operation, maybe a character, delete, insert or enter could potentially trigger it.

If you want to test if a mouse hover operation would work for your case, you could use custom javascript in a ‘run javascript operation’ to simulate a mouse over event. The following javascript will trigger a mouse over event (tested in chrome) you’ll have to adjust the xpath for your case.

var element = document.evaluate(‘XPATH_GOES_HERE’, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var bounds = element.getBoundingClientRect();
element.dispatchEvent(new MouseEvent(‘mouseover’, {clientX:bounds.left,, button:0, shiftKey:false, altKey:false, ctrlKey:false, view:window, bubbles:true, cancelable:true}));

Hi Cass,

Thanks for the suggestions. I couldn’t get the Javascript to have any effect, but sending a keystroke to the [ul] element did the trick - it got focus and I could manipulate the other controls. A few keys triggered application shortcuts, so after checking the documentation, I ended up using ‘#’.