Puppeteer & PyTest

pytest-pyppeteer is a Python framework to use with Puppeteer.
Together with pytest-asyncio, you can write asynchronous PyTest tests which connect to the TestingBot browser grid. Run tests in parallel on the TestingBot browser grid with PyTest, Pyppeteer and pytest-asyncio.

To get started, please install these packages:

pip install pytest-asyncio pyppeteer

Now you're ready to use Python with Puppeteer. There's some more information about Pyppeteer on their documentation pages.


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 Puppeteer.

import pytest
import pyppeteer

async def test_title():
    browser = await pyppeteer.connect(browserWSEndpoint='wss://cloud.testingbot.com?key=api_key&secret=api_secret&browserName=chrome&browserVersion=latest')

    page = await browser.newPage()
    await page.goto('https://testingbot.com')
    title = await page.title()
    assert title == 'Cross Browser Testing and Mobile App Testing | TestingBot'
    await browser.close()
  except E:

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

We use @pytest.mark.asyncio to let PyTest know that we're using await.
Please see pytest-asyncio for more information about event loops, awaits and fixtures.

Specifying browser and version

To specify on which browser and version your PyTest + Puppeteer test should run, you can include both a browserName and browserVersion in the browserWSEndpoint URL.

Select a browser & version

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.