Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Element is not opened in fullscreen mode ( chrome / chromium ) #27598

Open
PiotrSF opened this issue Oct 13, 2023 · 12 comments
Open

[BUG] Element is not opened in fullscreen mode ( chrome / chromium ) #27598

PiotrSF opened this issue Oct 13, 2023 · 12 comments
Labels
browser-chromium P3-collecting-feedback upstream This is a bug in something playwright depends on, like a browser.

Comments

@PiotrSF
Copy link

PiotrSF commented Oct 13, 2023

System info

  • Playwright Version: 1.39.0
  • Operating System: macOS Ventura 13.5
  • Browser: Chromium
  • Other info:

Source code / Test code

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

test.describe(`Fullscreen tests`, () => {

    test(`#1 Should open Fullscreen`, async ({ page })=> {

        await page.goto(`https://pktestblog1.blogspot.com/p/fullscreen-page.html`);
        await page.locator('#openFullscreen').click();
    })
})

HTML code for simple FS page is in .pdf in attachments

Config file

playwright.config.ts

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
 {
      name: 'Google Chrome',
      use: {
            ...devices['Desktop Chrome'], channel: 'chrome',
            launchOptions: {
            chromiumSandbox: true,
            ignoreDefaultArgs: [`--hide-scrollbars`],
            args: ['--disable-web-security'],
            },
            permissions: ["clipboard-read"],
     },
    },

Expected

Element should be opened in FS mode, works for firefox / webkit :
FS in firefox

Actual

Button is found and clicked but element is not opened in fullscreen mode
no FS in chrome

Note
Fullscreen functionality for web element is crucial for our product and in our tests, thanks in advance.

fullscreen page.pdf

@viraxslot
Copy link

Hi, I believe the issue might be related to the screenshot being taken too quickly, which is why the full-screen mode isn't visible. I made some slight changes to your script, and it works fine for me.

test.describe.only(`Fullscreen tests`, () => {
  test(`#1 Should open Fullscreen`, async ({ page }) => {
    const title = "Fullscreen page";
    await page.goto(`https://pktestblog1.blogspot.com/p/fullscreen-page.html`);
    await expect(page.getByText(title)).toBeVisible();
    await page.locator("#openFullscreen").click();
    
    // for checking
    await page.waitForTimeout(500);
    await page.screenshot({ path: "full-screen.png" });
  });
});

Of course it's a bad practise to wait for a timeout. So you can add some hidden element that will appear/diappear in the full-screen mode and wait for it.

The result of the above script:
image

@kmlynski
Copy link

Hi @viraxslot
Your solution seems to not be working on chromium still. Here's the link to quick reproduction:
https://try.playwright.tech/?l=javascript&s=pzvu6ds

@PiotrSF
Copy link
Author

PiotrSF commented Oct 13, 2023

Hey @viraxslot,

thanks for the comment but I was checking with time outs also before I created an issue but they don't help for chromium in anyway.

@yury-s
Copy link
Member

yury-s commented Oct 17, 2023

Hi @viraxslot Your solution seems to not be working on chromium still. Here's the link to quick reproduction: https://try.playwright.tech/?l=javascript&s=pzvu6ds

The test will pass in headed if you move waitForTimeout to line 17:
image

@yury-s
Copy link
Member

yury-s commented Oct 17, 2023

Hey @viraxslot,

thanks for the comment but I was checking with time outs also before I created an issue but they don't help for chromium in anyway.

The element does not get into full screen mode in headless browser today. I headed it should be working fine if yo wait long enough. See also #1086

@yury-s
Copy link
Member

yury-s commented Oct 18, 2023

Filed upstream bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1493760

Meanwhile you can run with --headless=new as a workaround:

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

test.use({
  launchOptions: {
    args: ['--headless=new']
  }
})

test(`simple test`, async ({ page }) => {
  await page.setContent(`
    <script>
    function openFullscreen(event) {
      event.target.requestFullscreen();
    }
    </script>
    <div style="width: 500; height: 500; background-color: green" onclick='openFullscreen(event)'></div>
    `);
  await page.locator('div').click();
  await page.waitForTimeout(1000);
  await page.screenshot({ path: "full-screen.png" });
});

@yury-s yury-s added P3-collecting-feedback browser-chromium upstream This is a bug in something playwright depends on, like a browser. and removed triaging labels Oct 18, 2023
@PiotrSF
Copy link
Author

PiotrSF commented Oct 18, 2023

Thanks @yury-s, args: ['--headless=new'] works great!

@yury-s
Copy link
Member

yury-s commented Nov 6, 2023

Filed upstream bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1493760

The upstream issue was fixed and the fix should make it to Playwright in 1.41.

@jaktestowac
Copy link
Contributor

@yury-s can you confirm that it is part of Playwright 1.41?

@PiotrSF
Copy link
Author

PiotrSF commented Dec 10, 2023

Yup, I'm looking forward for this fix because args: ['--headless=new'] is not working in some cases anyway :/

@PiotrSF
Copy link
Author

PiotrSF commented Jan 17, 2024

Was this fix removed from 1.41 version ? :/

@carolhmj
Copy link

I'm seeing the same problem on 1.42, would love an update. I can provide a repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-chromium P3-collecting-feedback upstream This is a bug in something playwright depends on, like a browser.
Projects
None yet
Development

No branches or pull requests

6 participants