Back to Browse

Playwright Beginner Tutorial 10 | Slow Motion and Video Recording

40.1K views
Sep 9, 2022
19:35

ASK RAGHAV ► https://bit.ly/2CoJGWf QUIZ - https://forms.gle/V1gNBxZbWnoZozBdA T I M E S T A M P S ► 00:00 *Intro* 00:52 *How to run tests in Slow Motion | How to Record Video* Step 1 - Open config file and add option for slow motion and video recording const config = { use: { video: 'on', launchOptions:{ slowMo: 1000 } slowMo slows down Playwright operations by the specified milliseconds video: 'on' - Record video for each test 'off' - Do not record video 'retain-on-failure' - Record for each test, but remove from successful test runs 'on-first-retry' - Record only when retrying a test for the first time Step 2 - Save & Run Step 3 - Check Video files will appear in the test-results folder Note - SlowMo is a field in Class BrowserType.LaunchOptions https://www.javadoc.io/doc/com.microsoft.playwright/playwright/latest/com/microsoft/playwright/BrowserType.LaunchOptions.html 08:23 *Screenshot moment* 09:39 *How to set video recording and slow motion from test (Browser Context)* In Playwright we can create isolated incognito browser sessions using browser context 10:34 *Create a new test* // Launch browser const browser = await chromium.launch(); // Create a new incognito browser context const context = await browser.newContext(); // Create a new page inside context. const page = await context.newPage(); await page.goto('https://example.com'); // Dispose context once it's no longer needed. await context.close(); 13:49 *Set configurations for slow motion and video recording at test level* Step 1 - Create a test and create browser context Step 2 - Add options for Slow Motion in browser Step 3 - Add options for video recording in new context Step 4 - Close context // launch browser const browser = await chromium.launch({ headless: false, slowMo: 1000 }) // create a context for browser const context = await browser.newContext({ recordVideo: { dir: 'videos/', size: {width:800, height: 600} } }) 16:42 *Screenshot moment for test* 19:09 *Outro* #playwright #tutorial ▬▬ ALL FREE COURSES ► https://automationstepbystep.com/ ▬▬ RAGHAV PAL ▬▬ UDEMY ► https://www.udemy.com/user/raghav-pal-3/ GITHUB PROJECTS ► https://github.com/Raghav-Pal/ CORPORATE TRAINING ► https://automationstepbystep.com/corporate-training/ STORIES BY RAGHAV ► https://automationstepbystep.com/stories/ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Every LIKE & SUBSCRIPTION gives me great motivation to keep working for you You can support my mission for education by sharing this knowledge and helping as many people as you can If my work has helped you, consider helping any animal near you, in any way you can NEVER STOP LEARNING Raghav Pal

Download

1 formats

Video Formats

360pmp434.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Playwright Beginner Tutorial 10 | Slow Motion and Video Recording | NatokHD