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.

Writing tests

Writing tests

Now that we have set up our project, we can go ahead and write the tests. If you want, you can write tests for any other website. And if you're doing so, then skip this lesson, else you can follow along. Now let's say we want to open this website or this static page and view the same. To do that we can drop it into a browser, but a better way of performing the same is to locally host this file. To do that we can use Python's HTTP module. So let's open the terminal and move inside of the qubit directory which has our index.html. we can use python's HTTP server module. And optionally, we can provide it the port number, which is by default 8000. So if I go ahead and hit enter, it will start serving this index HTML file in our localhosts port 8000. So if I open a browser, and then the localhost that is 127 0.01 and colon to access the port number which is 8000 if i visit the same we get to see our sample website now this is a very simple website but it will serve our purpose so it has a…

Contents