robotframework-browser
robotframework-browser copied to clipboard
New Context with viewport set to None does not behave as in Playwright
Describe the bug
Given Chromium is started passing the parameter --start-maximized
When calling the keyword New Context viewport=${None}
Then the window is not maximized.
The corresponding code in Node.JS works as expected:
const playwright = require('playwright');
(async () => {
const browser = await playwright.chromium.launch({args: ["--start-maximized"], headless: false});
const context = await browser.newContext({viewport:null});
const page = await context.newPage();
await page.goto('https://browser.fi/');
await browser.close();
})();
To Reproduce Steps to reproduce the behavior:
Execute the following Robot Framework script:
*** Settings ***
Library Browser
*** Test Cases ***
Open Chromium Maximized
New Browser chromium headless=false args=["--start-maximized"]
New Context viewport=${None}
New Page https://browser.fi
Expected behavior Using Browser Library the window should be maximized, just like in Playwright.
Screenshots
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chromium
- Version: 102.0.5005.40
Additional context
@allcontributors please add @mardukbp for bugs
@mardukbp @aaltat Any ETA on this? Facing same issue while passing --start-maximized as args but browser is not maximizing on launch.
Keyword
start the browser
[Arguments] ${URL}=${BU_URL} ${LOGIN_CLIENT_ID}=${CLIENT_ID}
New Browser browser=${BROWSER}
... headless=${HEADLESS_MODE}
... args=["--start-maximized"]
New Context
New Page ${URL}/login?clientId=${LOGIN_CLIENT_ID}
Logs

This project, as many other open source projects, is run by people donating their free time without compensation. Therefore this project does not provide estimates when something will be done. If you have an urgent need, usually the fastest to way to get it fixed, is to provide a PR to deal the problem.
Sure @aaltat, intention was to check if someone looked into it. Will try to solve it.
For future: ETA is usually considered as really bad word in many open source communities, because many project run on people free time. There is excellent blog post about seeing OS as act of kindness.
But what words would be better then? Well, usually it is better to use words like: Is someone already looking on this issue and if not I could take a look or If no-one is looking at this problem, I can take a look. Or if you are reporting that you are also seeing the problem, just say: I think that am also seeing the same problem. and add the information included in your first post, without the first sentence. The later way is telling to the maintainers that other people are also seeing the problem and it gives maintainers valuable feedback what is important and what it not.
This is not trivial and i would really like to discuss the solution first, before anyone starts working on that.
Atm we do not send options to pw if they are set to ${NONE}, which means Option==${None} is not possible right now.
Will hopefully be fixed by #2308
Thanks @Snooz82
Do we need to pass args=["--start-maximized"] in New Browser as argument once this is available? or any workaround?
@aliasgerkw As far as i know, yes. you have to set that chrome argument. I can not test it, because on mac fullscreen does not work. But @mardukbp tested it on windows.
Fixed by #2308