Zooming out an element by scrolling mouse wheel

Hello all,
I am having trouble achieving a zoom out of a web element (not page, just the chart) by scrolling and hopefully someone can point me in the right direction.

The way it works in page is user moves mouse over the chart, and holds Alt key while rotating mouse wheel backwards. I tried it the following way:

Mouse Move Relative To    ${chart}
Keyboard Key    down     Alt
Mouse Wheel    0    -1000
Keyboard Key    up     Alt

I tried with even greater values of Mouse Wheel argument with no success. Also using Hover for moving mouse to element. I ended with Mouse Move Relative To, because I understand it moves the mouse to center of the element, which is ideal for my case.

Any tips will be most appreciated.
Thank you and best regards,

HI Josh,

Just a guess at what might be your issue, this line:

Mouse Move Relative To    ${chart}

is probably moving the moving the mouse to the top left corner of the chart which might be outside the zone where the scrolling takes effect.

You could try

Mouse Move Relative To    ${chart}    10    10

That might be enough to get you in the zone where the scrolling takes effect, if not get the size of the chart element first, divide the width and height by 2 and used this as offsets so your mouse ends up in the middle of the chart.

Hopefully that helps,



Hi @damies13

Thank you for your suggestion. I have tried it, as well as many other variants, with no success unfortunately. It could be that the actions of the Playwright implementation are not compatible with this particular page element. I might give it a final try with evaluating javascript.


1 Like

Instead of using Mouse Move Relative To before your keypress have you tried using the Hover keyword? I’d like to say both give the same result, but maybe it’s worth a try. The hover keyword does accept *modifiers as arguments, i.e., keypress, but they are only active during the hover, so I doubt they will be much use as they pressed during, from what I understand.

In addition to the other keyword, you can switch off playwrights actionability checks if that proves to be a problem.

Hi @_daryl , yes, Hover was one of the first alternatives I tried and unfortunately it didn’t give the desired result.
I did not consider switching off actionability checks. From what I see in docs, if one of the checks would fail, the keyword itself would fail during the test, which does not happen.

For javascript approach, I don’t know if something like this is useful anymore, but FYI

1 Like