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 Python REPL

Playwright Python REPL

In the previous section, we learned how can we create a simple playwright script to launch a browser, open a new page, visit a website, locate a button and click the same. In this section, we'll learn more about these locators and all the different ways playwright has to offer to select web elements. Now previously we learned about the get by role selector and what it does is allows us to select elements based on their role and the name attached to the same. We selected a link element with the name of dogs. Now if we would like we can select others as well. That is we can select a link element with the get started text on it. So we can just go ahead and run our script. So py app.py. Now you will see I use the py command instead of Python because I have ADS dead. You can do that as well. But let's just go ahead and run the app and you will see that it clicks on the get started button and goes inside of the intro. Now similarly we can virtually select any element with the role of a link…

Contents