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.

Playwright codegen

Playwright codegen

In this lesson, we'll learn about Playwright's CodeGen tool, which can be used to quickly generate some code for the actions we perform on a browser manually. That is, we can use the CodeGen using Playwright CodeGen command. Then we can give it the domain of any website. That is, let's say playwright.dev. Hit enter. will launch a browser and a inspector like this. So what you can do here is using this browser, you can interact with all the elements. You can see it shows the locators and the code will be written here for the action you perform. So here let's say if I go ahead and get it here and get this browser here let's just scroll a little bit so that we can look at our trace viewer nice now let's say if i go ahead and change the language from node.js to python so first of all i click on this button you can see page get by text this click on the same and then i'll click on the python link element click on the same again you can see the code for the same is added here now the url…

Contents