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

Events not triggered anymore after some time #229

Open
Xowap opened this issue Jun 14, 2019 · 1 comment
Open

Events not triggered anymore after some time #229

Xowap opened this issue Jun 14, 2019 · 1 comment

Comments

@Xowap
Copy link

Xowap commented Jun 14, 2019

Apparently, after about 20 seconds events/function calls triggered by the browser won't be triggered Python-side. Here is an example code for the demonstration:

import asyncio

from pyppeteer import launch

ping_script = """
    setInterval(function () {
        $$ping();
        console.log('ping!');
    }, 1000); 
"""

ping_count = 0


def ping():
    global ping_count

    print(f"GOT PING = {ping_count}")
    ping_count += 1


async def main():
    browser = await launch(headless=False, devtools=True)
    page = await browser.newPage()

    await page.exposeFunction("$$ping", ping)
    await page.evaluate(ping_script)


if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.create_task(main())
    loop.run_forever()

After about 20 seconds, the Python stops printing "GOT PING".

I can't find anything like this in the issues. I'm using version 0.0.25 in Linux with Chromium 69.0.3494.0. Can anybody else reproduce?

@Xowap
Copy link
Author

Xowap commented Jun 14, 2019

All right found it, it's related to #160

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

1 participant