playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] navigator.share not available in Docker Container

Open DoomyTheFroomy opened this issue 1 year ago • 3 comments
trafficstars

System info

  • Playwright Version: v1.39
  • Operating System: Official Docker Image (mcr.microsoft.com/playwright:v1.39.0-jammy)
  • Browser: All (depending on availability)
  • Other info:

The Web Share API is currently not implemented / available for all browsers and OS. It is also only available in secure contexts.

Source code

The following test case should be at least successful for Edge and Safari browser:

import { test, expect } from "@playwright/test";

test("Test availability of web share API", async ({ page }) => {
  await page.goto("https://mdn.github.io/dom-examples/web-share/")
  const isSecureContext = await page.evaluate(() => { return window.isSecureContext})
  expect(isSecureContext).toBeTruthy();

  const canShare = await page.evaluate(() => { return navigator.canShare && navigator.canShare() && navigator.share })
  expect(canShare).toBeTruthy()
});

Steps

  • Run the test for Safari / Edge without docker image
  • Run the test for Safari / Edge in docker image

Expected

The result should be the same

Actual

Web Share API is available in the browser without docker image. Web Share API is not available in the browser within a docker image. It doesn't matter which browser you run this test in the docker container it will always be not available.

Please let me know if any further information are required

DoomyTheFroomy avatar Dec 19 '23 13:12 DoomyTheFroomy

  • Run the test for Safari / Edge without docker image

Which platform are you running on without docker? According to MDN In Chromium it's 'Only supported on ChromeOS and Windows'.

yury-s avatar Dec 20 '23 01:12 yury-s

I'm running locally on OSX. This works all as expected! But the docker image (Linux?) does never get truthy! No matter which browser (e.g. Safari) you choose!

DoomyTheFroomy avatar Dec 20 '23 06:12 DoomyTheFroomy

This is still a problem. WebKit (mimicking Safari on iOS) implements canShare on OSX but not on Linux.

markusn avatar Feb 14 '24 09:02 markusn

Why was this issue closed?

Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.

Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.

pavelfeldman avatar Aug 16 '24 00:08 pavelfeldman