[Feature] BrowserContext.maximizeWindow()
See original GitHub issueRequested via Slack.
Scenario: Automate a website and then let the user complete something. Its great if the max possible width/height could be determined so the user has “maximum available viewport”.
But not sure how or if its easy implementable since we in CR e.g. emulate the viewport independent from the window size.
For Chromium it works already like that:
// @ts-check
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('http://whatsmyuseragent.org/');
await browser.close();
})();
Issue Analytics
- State:
- Created 3 years ago
- Reactions:75
- Comments:38 (3 by maintainers)
Top Results From Across the Web
WebdriverIO Tutorial: Browser Commands for ... - LambdaTest
newWindow command is used when you want to open a new url on a new browser window. Other parameters included are windoname and...
Read more >WebdriverIO Tutorial: Browser Commands for Selenium Testing
maximizeWindow command helps the browser to maximize the browser window for automated browser testing. Syntax: browser.maximizeWindow(). Example ...
Read more >26 - Maximize/Full Screen Browser in Playwright | ViewPortSize
In this video, I have explained how to maximize the browser window.Maximize/Full Screen Browser in Playwright | ViewPortSize | Playwright ...
Read more >chrome/test/chromedriver/test/run_py_tests.py - chromium/src
ChromeDriverLogTest tests an internal ChromeDriver feature, not needed ... Browser context management is not supported by Android ... MaximizeWindow().
Read more >Storybook Integration | Developer Guide - Nightwatch.js
In addition, Nightwatch provides a test() function which has access to its own APIs ... Runs in the browser context FilledForm.play = async...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A well-designed page behaves consistently across different viewports, so this is nothing for the testautomation framework to worry about. Trust me, in several years of TA experience, maximizing the browser window never caused any such issues, not even once. It’s also closer to the way a real user would behave. But Playwright artificially shrinks the viewport so the pages aren’t even displayed in full, which (despite it scrolling into elements) leads to page elements not being fully displayed while PW interacts with them.
Also to elaborate a bit further on the second point from my previous post: Not having a flexible (= maximized) resolution means I have to define a specific screen resolution (even
null
does mean 1280x720). But a static resolution could be incompatible with other people’s screens. Sizing the browser window flexibly via maximize eliminates that problem.Solution for Java: