---
title: PyTest and Playwright Testing | TestingBot
description: Run PyTests on Chrome and Edge with Playwright. Use playwright-python
  and pytest on a browser grid.
source_url:
  html: https://testingbot.com/support/web-automate/playwright/pytest
  md: https://testingbot.com/support/web-automate/playwright/pytest/index.md
---
# Playwright & PyTest

To use PyTest with Playwright, we'll need a Python library that automates via Playwright.   
 Microsoft's [playwright-python](https://github.com/microsoft/playwright-python) library provides a Python library which does Automation via Playwright.

To get started, please install these packages:

    pip install pytest-playwright
    playwright install

Now you're ready to use Python with Playwright. You can take a look at the [playwright-python examples](https://github.com/microsoft/playwright-python#usage) on how to do this.

## Example

To get started, please see this simple example below.   
 This will start a new Chrome browser in the TestingBot browser grid, and allow PyTest to control the browser via Playwright.

    import pytest
    from playwright.sync_api import Playwright
    
    @pytest.fixture
    def browser(playwright: Playwright):
      return playwright.chromium.connect(ws_endpoint = 'wss://cloud.testingbot.com/playwright?key=api_key&secret=api_secret&browserName=chrome&browserVersion=latest', timeout=90000)
    
    def test_title(browser):
      page = browser.new_page()
      page.goto('https://testingbot.com')
      assert page.title() == 'TestingBot: Cross Browser Testing and Mobile App Testing'
      browser.close()

  

This example will open a Chrome browser, navigate to the TestingBot homepage and verify the page's title.

## Parallel Testing with PyTest

One of the great advantages of our service is that you can run multiple tests simultaneously (in parallel).   
 This drastically shortens the total duration of your test suite, as multiple tests will run concurrently.

  

We recommend using [pytest-parallel](https://pypi.org/project/pytest-parallel/).

Was this page helpful? Yes No 

## Looking for More Help?

Have questions or need more information?   
 You can reach us via the following channels:

- [Email us](https://testingbot.com/contact/new)
- [Join our Slack Channel](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
