robotframework-browser icon indicating copy to clipboard operation
robotframework-browser copied to clipboard

New Context with viewport set to None does not behave as in Playwright

Open mardukbp opened this issue 3 years ago • 6 comments

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

mardukbp avatar May 24 '22 09:05 mardukbp

@allcontributors please add @mardukbp for bugs

aaltat avatar May 25 '22 18:05 aaltat

@aaltat

I've put up a pull request to add @mardukbp! :tada:

allcontributors[bot] avatar May 25 '22 18:05 allcontributors[bot]

@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 Screenshot 2022-06-28 at 3 04 54 PM

aliasgerkw avatar Jun 28 '22 09:06 aliasgerkw

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.

aaltat avatar Jun 29 '22 07:06 aaltat

Sure @aaltat, intention was to check if someone looked into it. Will try to solve it.

aliasgerkw avatar Jun 29 '22 07:06 aliasgerkw

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.

aaltat avatar Jun 29 '22 08:06 aaltat

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.

Snooz82 avatar Sep 14 '22 14:09 Snooz82

Will hopefully be fixed by #2308

Snooz82 avatar Sep 18 '22 22:09 Snooz82

Thanks @Snooz82 Do we need to pass args=["--start-maximized"] in New Browser as argument once this is available? or any workaround?

aliasgerkw avatar Sep 19 '22 07:09 aliasgerkw

@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.

Snooz82 avatar Sep 23 '22 19:09 Snooz82

Fixed by #2308

Snooz82 avatar Sep 23 '22 19:09 Snooz82