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.

Script overview

Script overview

In the previous lesson, we learned how to locate the link element using its role and its name. Now that link element can be clicked using the click method. And when that happens, the page navigates to the documentation's website. Now we can simply go ahead and get the URL and print it out. So we'll go ahead and get the URL. To do that, we can just use the page object in which the navigation is happening and use the URL attribute as simple as that. So we can just go ahead and print out the same. That is the docs. Now let's go ahead and run our Python file. So I will visit the page, click on the button, and navigate to the docs url, and print it out. So that's the first playwright script which we have written, which is of course simple, but enough to get things started. So what we learned is how to launch a browser, and set some configurations to make sure it It's easy to debug the same. Then we learn how to launch a page, visit a website, locate elements by its role and a name on the…

Contents