← Back to Discord Forum

sometime reload function failed in loop

I am using playwright asynchronously within fastapi.

async def loop():
    while true:
        await page.reload()
        await asyncio.sleep(10)

async def test():

When using the code above, an error occurs within a few hours.

this is full error message

Task exception was never retrieved
future: <Task finished name='Task-6' coro=<Connection.run() done, defined at /root/.local/share/virtualenvs/localServer-8gKvcJZF/lib/python3.10/site-packages/playwright/_impl/_connection.py:267> exception=AttributeError("'dict' object has no attribute '_object'")>
Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/localServer-8gKvcJZF/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 276, in run
    await self._transport.run()
  File "/root/.local/share/virtualenvs/localServer-8gKvcJZF/lib/python3.10/site-packages/playwright/_impl/_transport.py"
8gKvcJZF/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 513, in from_nullable_channel
    return channel._object if channel else None
AttributeError: 'dict' object has no attribute '_object'

How can i solve this?

This thread is trying to answer question "How can I solve the AttributeError that occurs when I try to reload a page in a loop using Playwright asynchronously within FastAPI?"

1 reply

Hi, do you have the latest version of Playwright?

If yes, then probably you can best create a GitHub issue for this, since it sounds like quite a low-level error. https://github.com/microsoft/playwright-python/

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.