aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.57k stars 322 forks source link

How to (re)set initial mouse position for OS? #1163

Open qtis opened 2 years ago

qtis commented 2 years ago

We are experiencing problem that OS cursor seems to be placed in the middle of the screen and affects mouse events when application is running.

I took a screenshot from recording (before chrome starts, which is in next second) and you can see mouse cursor in the middle of the screen.

image

Is there a way to control or remove OS mouse cursor as chromedriver (via webdriver) seems to emulate it's own cursor, not via OS so you end up with two cursors :|

vania-pooh commented 2 years ago

@qtis you can add xdotool command call to browser image entrypoint.sh to fix this. Currently this is not supported out of the box.

qtis commented 2 years ago

@qtis you can add xdotool command call to browser image entrypoint.sh to fix this. Currently this is not supported out of the box.

That helped. Now I've built custom image based on chrome_vnc with xdotool installed via Docker build and extra line in entrypoint.sh before chromedriver start:

echo Moving mouse to position 0 0
DISPLAY="$DISPLAY" /usr/bin/xdotool mousemove 0 0

You can see it is in the corner now:

image

Request Would be great if you could also add it to official images as same issue might be causing issues for other as well. Otherwise I guess I'd have to rebuild custom images on each release ¯_(ツ)_/¯

gdonati78 commented 2 years ago

We experience a cursor displayed when we run Chrome with mobile emulation enabled (experimental option mobileEmulation). No cursor would be expected, none is shown when using other hubs with the same settings. Is it related to this same issue?

vania-pooh commented 2 years ago

@gdonati78 Chrome in mobile emulation is the same as Chrome desktop. So yes, that's related.