-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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] device* media queries are not triggered with viewport emulation #1291
Comments
@tomgallagher to the best of my knowledge, viewport emulation should be enough 🤔 can you give an example? |
Hi, thanks for getting back By way of an example, go to this site There's a sub-header banner that has the following media rule
It does not show in retrieved screenshot when the viewport is set and browser context confirmed as:
But it shows when launching the browser with:
|
@tomgallagher thank you for the great repro! This is fixed on Chromium now; the We'll fix this in other browsers as well! |
Good stuff! 😄 |
#1565 fixed this for Firefox. |
I believe this is now fixed in all browsers 🎉 |
If you want to test sites with media queries, setting the viewport is not enough.
I've found that I also need to change the window size to accommodate media queries and accurately reflect what a user would see with certain screen sizes
await chromium.launch({args: [
--window-size=${someWidth},${someHeight}]});
That's easy enough thanks to your helpful device dictionary.
Am I missing something here?
Is it possible to change the default window size on all browser instances launched by Playwright?
Failing that, are there comparable flags for Firefox and Webkit?
The text was updated successfully, but these errors were encountered: