MarketSquare / robotframework-browser

Robot Framework Browser library powered by Playwright.
Apache License 2.0
528 stars 106 forks source link

Window Size #3864

Closed Houbein closed 2 weeks ago

Houbein commented 1 month ago

Describe the bug The viewport argument of New Context does not work. According to the documentation; the New Context keyword has an argument viewport that allows you to set the width and hight to 0 so it will scale automatically with the window. This does not happen. If I set these values to 0, all I get is a tiny window that does not scale at all. To Reproduce Steps to reproduce the behavior:

  1. New Browser browser=chromium
  2. New Context with viewport={'width': '0', 'height': '0'} *Expected behavior A browser window that detects my window size and automatically scales to that size.

Desktop (please complete the following information):

aaltat commented 1 month ago

@allcontributors please add @Houbein for bugs

allcontributors[bot] commented 1 month ago

@aaltat

@Houbein already contributed before to bug

Snooz82 commented 3 weeks ago

Does it behave differently than in this video? I tried it and it works exactly as expected.

Yes the window is small, but if you resize the window, the viewport resizes/scales together with the outer size.

https://github.com/user-attachments/assets/da8b0e43-d341-4f99-a494-07c1b3767d0d

Viewport is window.innerWidth and window.innerHeight . The window that you as a user might resize is window.outerWidth and window.outerHeight.

With a fixed viewport the page always has the same size independently of the screen size. This can also be bigger than the outer size.

If your seen behaviour is still a different one, please describe more.

Houbein commented 2 weeks ago

Ah, I'm sorry I misinterpreted the documentation to mean that with viewport 0 it would always open scaled to the full resolution of my browser.

Snooz82 commented 2 weeks ago

@Houbein

you may also want to look at #2054

you can set the viewport to ${NONE} and give the following argument to New Browser args=["--start-maximized"]