Search code examples
pythonpytestpuppeteerpyppeteerpytest-asyncio

Pytest-asyncio not moving to next statement when using with pyppeteer


I am trying to run Pyppeteer with pytest but after launching chromium it's not going to the next statement.

import asyncio
import pytest
from pyppeteer import launch

@pytest.mark.asyncio
async def test_BackendWeb():
    browser = await launch(headless=False)
    page = await pyppeteer.new_page()
    await page.goto('https://www.google.com/')

After running this browser is launched but the new page is not opened.


Solution

  • Use browser.new_page instead pyppeteer.new_page:

    page = await browser.new_page()