docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

[🐛 Bug]: Dependencies missing for CSS @media pointer support

Open kristaps-aksjonovs opened this issue 1 year ago • 7 comments

What happened?

Hello.

Suspicion is that there is missing dependency that needs to be install for Docker. Our website is using CSS https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer. Chrome browser should register pointer:fine when mouse event is sent but it uses pointer:none.

For testing I'm using WebdriverIO.

Javascript injected into page to test

        const style = document.createElement("style");
        style.id = "hoverStyff";
        style.innerText = `@media (pointer: fine) {[data-role="my-button"] {background: red !important;}}@media (pointer: coarse) {[data-role="my-button"] {background: green !important;}}@media (pointer: none) {[data-role="my-button"] {background: blue !important;}}`;        const head = document.querySelector("head");
        if (head) {
            head.appendChild(style);
        }

Expected:

Red Background would appear

@media (pointer: fine) {[data-role="my-button"] {background: red !important;}}

Actual

Blue background appears.

When executing tests against local Chrome on MacOS expected red background is displayed but in container blue. I also tried to add Chrome start arguments:

--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4

but it didn't help.

Command used to start Selenium Grid with Docker (or Kubernetes)

docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:108.0

Relevant log output

-

Operating System

macOS Sonoma 14.5

Docker Selenium version (image tag)

selenium/standalone-chrome:108.0

Selenium Grid chart version (chart version)

No response

kristaps-aksjonovs avatar Aug 15 '24 13:08 kristaps-aksjonovs

@kristaps-aksjonovs, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Aug 15 '24 13:08 github-actions[bot]

macOS Sonoma 14.5

Is this Apple M-series chip? If yes, can you try recently standalone-chromium image tag and confirm. I feel this issue could be related to Chromedriver, and there is no actionable from the docker side.

VietND96 avatar Sep 09 '24 03:09 VietND96

Hello @VietND96 , I checked with latest standalone-chromium same reproducible. I also tried to run on MacBook Intel version, chrome and chromium and also the same.

kristaps-aksjonovs avatar Sep 09 '24 09:09 kristaps-aksjonovs

Any updates on this?

kristaps-aksjonovs avatar Oct 15 '24 09:10 kristaps-aksjonovs

Did you try to run the test without docker selenium? If you are facing the same issue, I think it is an issue with Chromedriver.

VietND96 avatar Oct 16 '24 04:10 VietND96

One more query, did your test run in headless mode? Since I saw you mentioned that

Chrome browser should register pointer:fine when mouse event is sent but it uses pointer:none.

So, if you are running in headless mode, try to disable it.

VietND96 avatar Nov 12 '24 00:11 VietND96

For anyone else who is having this issue, a fix to force chromiums to apply the media query pointer is by adding the following flags: '--blink-settings=primaryPointerType=4'

a-maggi avatar May 22 '25 21:05 a-maggi