-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add support for "isLandscape" argument for "browsingContext.setViewport" command #771
Comments
I don't really understand the use case here. If you want to set a landscape display, just set a larger width than height. One can also imagine a tablet or a fold-out phone with a square display. Is there anything else that this is controlling? |
We would have to let Puppeteer or Playwright folks speak up here. But I assume that this is helpful for the |
Yes, feedback from client authors would be very helpful. On the face of it I don't see why setting a boolean is much easier than swapping argument values, but maybe I'm missing some extra bit of state that this value controls. |
We use CDP's screenOrientation, like Puppeteer to emulate |
Puppeteer uses it to emulate https://w3c.github.io/screen-orientation/#dom-screen-orientation (tests) and uses the same method. A workaround for a one-time emulation can be probably done using a preload script but it might be also useful to emulate the screen orientation dynamically to test transitions from one mode to another after the page is loaded. From the WebDriver BiDi spec perspective, we should probably closer follow the corresponding Web spec and what CDP does instead of only exposing isLandscape flag. Perhaps, we should even define the WebDriver API in https://w3c.github.io/screen-orientation/#dom-screen-orientation (although I am not sure if this feature might span multiple specifications in the future). |
At least in gecko, the effective orientation seems to initially be set with just the So I wouldn't be opposed to adding an angle parameter, but we might need some mechanism to indicate that certain values are unsupported; I'm not sure. |
(alternatively I suppose just allowing setting the orientation type to one of the four supported values might be enough, and the angle could be calculated). |
Both Puppeteer and Playwright support an
isLandscape
boolean parameter for thesetViewport
command, which is currently missing in WebDriver BiDi. We should add support for this parameter with the following behavior:Default Behavior: By default,
isLandscape
is set tofalse
, meaning the orientation will not change, even if thewidth
is smaller than theheight
of the requested viewport.Landscape Mode: If
isLandscape
is set totrue
, the provided dimensions will automatically swap when thewidth
is smaller than theheight
(e.g., a setting of 800x1280 will result in a viewport of 1280x800).Portrait Mode: To force portrait mode,
isLandscape
should be set tofalse
, and the dimensions must be manually specified (e.g., 800x1280).The text was updated successfully, but these errors were encountered: