Skip to content
This repository was archived by the owner on May 8, 2020. It is now read-only.
This repository was archived by the owner on May 8, 2020. It is now read-only.

Execution context was destroyed, most likely because of a navigation. #302

@wonghang

Description

@wonghang

Hi, I have a webpage having a button to go to next page and then I want to click it.
I follow the document written in https://miyakogi.github.io/pyppeteer/reference.html and use the following pattern:

await asyncio.gather(
    page.waitForNavigation(),
    page.click("#foobar"),
)

Most of time, it works fine. But occasionally, I will get the following errors:

  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/page.py", line 1548, in click
    await frame.click(selector, options, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/frame_manager.py", line 581, in click
    handle = await self.J(selector)
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/frame_manager.py", line 317, in querySelector
    value = await document.querySelector(selector)
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/element_handle.py", line 360, in querySelector
    self, selector,
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/execution_context.py", line 108, in evaluateHandle
    _rewriteError(e)
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/execution_context.py", line 237, in _rewriteError
    raise type(error)(msg)
pyppeteer.errors.NetworkError: Execution context was destroyed, most likely because of a navigation.

Any idea or workaround?

I am using the following version of pyppeteer:

$ python3.7 -m pip list | grep pyppeteer
pyppeteer (0.0.25)

I think it is a related issue: puppeteer/puppeteer#5056

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions