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.

Launching browser

Launching browser

Now, we can get started with creating our script to visit the Playwright's home page, click on the docs button and visit the documentation's website. Now to do that, we'll need the Playwright's API to actually launch a browser and perform the seed things. But to do that, we need to know about, there are two APIs in playwright, synchronous and asynchronous. The synchronous one works just like any normal python code. The asynchronous one uses the async and await keywords to control the flow of execution. Its alright if you are not familiar with the same, because we will use the synchronous API to get started. And then we can discuss about the asynchronous one in a future lesson. So let's go ahead and import that in our Python file from playwright.sync API, that is synchronous API. We'll go ahead and import sync playwright and using the sync playwright, we can go ahead and start a new playwright instance and perform our tasks. But to do that we can either use simply write, instantiate…

Contents