The website that I should test has a button that sets the browser to Full Screen mode, and it works just as it should when pressing it manually in a browser that is not controlled by Playwright.
When I run the test cases the button doesn’t seem to do anything (other then change its color) in chromium and webkit. In Firefox it actual activates the Full Screen mode, but when the script clicks on it again to escape the full screen mode, it doesn’t escape it.
I’m guessing that it won’t resize because the viewport size is set when the context is created at start up and that kind of blocks the function.
Does anyone have an idea how the button could be made to work without resizing the viewport via script?
dunno about browser library but i feel you you need to mention; are you running “headless” ?
Hi Gergely,
- New Context has a
viewport
option where you can change the default window size of (1280x720) when you open the context. - Set Viewport Size lets you change the window size during the test
Hopefully one of those will give you what you need,
Dave.
I don’t think you’ve read the last sentence.
The browser should be resized when clicking on the button. Setting it via script wouldn’t test the button itself.
Hi Gergely,
You’re right I missed that bit (sorry)
There is Get Viewport Size, that you could use to confirm the size of the window before and after the button press, I guess if you use Set Viewport Size
to make it smaller first, then click the button and confirm it became bigger?
I notice that Browser doesn’t have a Maximise like SeleniumLibrary does, so you might need to use Evaluate JavaScript to ensure the browser window is not maximised before you do the test.
Hope that’s helpful,
Dave.