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

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

Open
wonghang opened this issue Mar 24, 2020 · 2 comments
Open

Comments

@wonghang
Copy link

wonghang commented Mar 24, 2020

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

@Mattwmaster58
Copy link

Hi @wonghang , it looks like this project has been abandoned. You may want to consider the active fork pyppeteer2. Feel free to create an issue there if your problem persists with the updated library.

@wonghang
Copy link
Author

@Mattwmaster58 thanks. Let me check it out and see if it fixes the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants