🎯 Key Takeaways for quick navigation: 00:18 🌐 *Playwright lacks a direct method to maximize the screen, but the "viewport" feature provides a solution to set and get the width and height of the browser page.* 02:11 📏 *Use the "viewport" feature to dynamically change screen size based on testing requirements. Capture and print width and height, adjusting them as needed.* 04:27 ⚙️ *Set viewport size globally in `playwright.config.js` for the entire project. For test-specific changes, use `test.use` in the test file, allowing flexibility in adapting viewport settings.* Made with HARPA AI
@MikeL-q1e3 ай бұрын
Perfect. This video is just what i was looking for. Simple and to the point.
@Mukeshotwani3 ай бұрын
Thanks mate 😀
@ghummakad_premi Жыл бұрын
There is another method that Playwright gives which is passing the chrome options like --start-maximized or --start-fullscreen . If this method doesn't work for you, try passing these in the config file.
@Mukeshotwani Жыл бұрын
Thanks Rahul
@AutomationeLearn10 ай бұрын
@Satyam_Gupta_1920 you have to use like this. comment device and viewport and add viewport: null use: { launchOptions: { args: ["--start-maximized"], }, } projects: [ { name: 'chromium', use: { //...devices['Desktop Chrome'], //viewport: { width: 1720, height: 850 }, viewport: null, }, }]
@salmaakhter6359 Жыл бұрын
Very helpful. Thank you Mukesh.
@ProfessorSauvaje Жыл бұрын
good job
@Mukeshotwani Жыл бұрын
Thanks
@jiras.3592 Жыл бұрын
Is it the best practice to declare the viewport in the same test file? I want to specify the viewport in each test file because I will test on Desktop and Mobile size. But I'm not sure if it is the best way.. 😢
@TausifJaved Жыл бұрын
Thanks for the tutorial setViewportSize changes the height and width of the window but not its position do we have something to replicate selenium window maximize in playwright?
@sandeepsan22182 жыл бұрын
Hi Mukesh, I don't know is it a right place to ask this question, Does playwright support for OTT platform application as u know it has all almost audio and video playing. Also can u suggest is there any specific/good tool that support for OTT. Appreciate to the way you presents.
@divyaarora9341 Жыл бұрын
What if I run the code in an extended screen whose view port size is different. It won't work there. This method doesn't look like an ideal solution.
@Mukeshotwani Жыл бұрын
Hi Divya, development and execution is 2 different part. Eventually your test will be executed on VM or Docker Container during CI-CD, so you need to test according to that as well. Taking about extended screen for development you need to consider at-least one of the screen as primary and change the view port accordingly.
@salikhanan Жыл бұрын
Hello, I get following any Idea why? Error: Playwright Test did not expect test.use() to be called here. Most common reasons include: - You are calling test.use() in a configuration file. - You are calling test.use() in a file that is imported by the configuration file. - You have two different versions of @playwright/test. This usually happens when one of the dependencies in your package.json depends on @pla
@DrashtiPatel-uc8zq5 ай бұрын
I want to run test in headless mode and screen maximized. Is it possible?
@Mukeshotwani5 ай бұрын
Yes why not. By default playwright test runs in headless mode when you run from CLI
@karthikeyann220326 күн бұрын
Can you tell How to zoom in and zoom out using playwright
@Mukeshotwani23 күн бұрын
Using keyboard Controls
@ostap.koverko9 ай бұрын
Thanks!
@Mukeshotwani8 ай бұрын
Welcome
@ninacdr8 ай бұрын
um verdadeiro ANJO
@Mukeshotwani7 ай бұрын
Muito obrigado querido
@Pancham2004 ай бұрын
How to set browser zoom level to 67% view rather than 100% as per the application need?
@jainam62 жыл бұрын
1st view
@hasanrakibul97 Жыл бұрын
But it doesn't work for windows
@Mukeshotwani Жыл бұрын
What worked for you?
@sagarsjdjfn Жыл бұрын
not working
@alexandre_borissov5 ай бұрын
the name of this video is confusing: there's no info on maximizing the window - just on setting viewport size. dislike
@Mukeshotwani5 ай бұрын
We don’t have any method for maximize so this is the fix which I provided by setting viewport.