Skip to content
New issue

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

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

Already on GitHub? # to your account

Chrome 128 - window-size is ignored (chrome-for-testing, headless, linux) #638

Open
yblatti opened this issue Aug 27, 2024 · 7 comments
Open

Comments

@yblatti
Copy link

yblatti commented Aug 27, 2024

I have a Symfony app (7.1).
For e2e tests I use phpunit + symfony/panther + Chrome for Testing headless (on Debian Linux bullseye).

Since Chrome 128 has been released, my CI fails as the --window-size chrome argument is ignored.

I wrote a reproducer here : https://github.com/yblatti/repro-panther-screen-size-chrome

It seems to indicates that this has been introduced with Chrome 128.0.6575.0.

I have tried to have a look at https://chromium.googlesource.com/chromium/src/+log/128.0.6542.0..128.0.6543.0?pretty=fuller&n=10000
... but this way out of my league.

@yblatti
Copy link
Author

yblatti commented Aug 27, 2024

I found that : https://chromium.googlesource.com/chromium/src/+/b9b39a430f71c710d16aafcc67278ef77440c18d

[headless] Change --headless switch default to 'new'

Specifying the --headless switch will activate new Headless mode.
Old Headless mode is still available if requested explicitly with --headless=old.

It seems that headless mode is changing, and we can use --headless=old to keep the previous behavior (for how long tho..)

Any hint on how to set size with new headless ?

@dunglas
Copy link
Member

dunglas commented Aug 28, 2024

According to their docs, the --window-size flag is supported by both the old and the new mode: https://developer.chrome.com/docs/chromium/new-headless

It's maybe a bug in Chrome?

@yblatti
Copy link
Author

yblatti commented Aug 28, 2024

Thanks for your time and feedback @dunglas :)

I reported it here : https://issues.chromium.org/issues/362522328

@Chris53897
Copy link

This worked for me. Just in case, someone is looking for a quick solution. I am not sure if the bug is solved.

$browser = Client::createChromeClient(
            arguments: [
                '--window-size=1400,800',
                '--headless=new',
            ],
 );

@llupa
Copy link

llupa commented Oct 31, 2024

I had the same exact issue as OP with Chrome v130. The only solution for me was to use --headless=old

@codegain
Copy link
Contributor

Had problem with setting window-size and setting the download directory via download.default_directory/savefile.default_directory after upgrading the chrome version to v131.

Using

PANTHER_NO_HEADLESS=true
PANTHER_CHROME_ARGUMENTS="--headless=old --disable-gpu --window-size=1920,1080"

instead of

PANTHER_CHROME_ARGUMENTS="--window-size=1920,1080"

fixed it for me.

@yblatti
Copy link
Author

yblatti commented Dec 11, 2024

PANTHER_CHROME_ARGUMENTS="--headless=old --disable-gpu --window-size=1920,1080"

Yes, but this is short term as Chrome devs say "We're happy to announce that the old Headless mode will be removed in Chrome 132" (source : https://developer.chrome.com/blog/removing-headless-old-from-chrome).

For now, I've switched to chrome-headless-shell (https://developer.chrome.com/blog/chrome-headless-shell).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants