-
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]: Method "setIsMobile" not working in Java #31510
Comments
As per the documentation what
So this does not affect the viewport/screen size. If you want to change the viewport, you can follow this: https://playwright.dev/java/docs/emulation#devices |
Thanks for the answer. However, I don't understand whether anything other than resolution needs to be set. I entered the values corresponding to desktop. To change the appearance to the mobile version, do I have to substitute values in the viewport in some way or is it enough to set a flag? My current code: |
Looks good, in a nutshell its e.g. for an iPhone 15 Pro max the following: playwright/packages/playwright-core/src/server/deviceDescriptorsSource.json Lines 928 to 942 in 1c69d3e
So you could emulate screen, userAgent, deviceScaleRatio as well. Probably related to microsoft/playwright-java#939 - maybe its available in junit already with the bindings. |
Version
1.44.0
Steps to reproduce
I have the code:
try (Playwright playwright = Playwright.create()) { Browser.NewContextOptions contextOptions = new Browser.NewContextOptions() .setIsMobile(true) .setHasTouch(true);
Based on the documentation, I understand that this code should start emulating and a window should open for the mobile version.
Expected behavior
I see a "small window" for the mobile version.
Actual behavior
I see the standard window for the desktop version.
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: