From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Record video

Record video

In the previous lesson, we learned how can we save our webpage as a screenshot. Now wouldn't it be cool if we can save the whole test session as a video file. Well, in this lesson we'll go ahead and see how can we record our test to a video file. Now to do that we'll require a browser context. So let's go ahead and get the same in our test function. And to do the same we will go ahead and request for the browser fixture inside of our test function. We'll get the browser fixture which is the type of browser. Let's go ahead and import it and hint on its type. Now we can simply go ahead and use browser new context like this to create a new context. Now to this context when we created we have to provide a argument that will enable the recording of the session and that argument is record video directory. So we specify a directory say video like this play right we'll go ahead and save the sessions from this context to a video file and the name will be generated dynamically so let's Let's go…

Contents