Rayrun
← Back to videos

Maximize Window | Playwright Tutorial - Part 72

How to maximize the browser window in Playwright?

In this video tutorial, the instructor explains how to maximize the browser when running test scripts using Playwright. By default, the browser launched with Playwright is not maximized, unlike Selenium.

The video provides two methods to maximize the browser.

The first method involves modifying the playwright.config.ts file. By setting the viewport to null and enabling the args option with --start-maximized for Chromium-based browsers, the browser will launch in maximized mode. However, the --start-maximized option only works for Chromium and not for Firefox or Webkit browsers.

The second method allows for specifying the viewport size for a specific test. By using test.use and providing the desired height and width, the browser will be launched in a specified viewport. The instructor suggests using the window.outerWidth and window.outerHeight properties in the browser console to determine the appropriate width and height values.

The instructor demonstrates the second method by providing a sample height and width and executing the test script. However, it is mentioned that this method only sets the window size and not the maximized mode as seen in the first method.

The video concludes by mentioning that the first method works for all browsers but the second method only works for Chromium-based browsers. The instructor also mentions that they were unable to find a maximized configuration for Firefox.

Overall, the video provides a quick tutorial on maximizing the browser when using Playwright and offers two different methods to achieve this goal.

Related Videos

#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
How to Code a Test Automation on Youtube | Playwright JS
How to Code a Test Automation on Youtube | Playwright JS
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Playwright - Set timeout, parallelisation and retries directly in your test files
Playwright - Set timeout, parallelisation and retries directly in your test files
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.