I have pyppeteer code that browses around. Let's assume it only clicks on a tags.
It runs fine on my local Windows machine, but breaks whenever I run it remotely on a Linux server. Same conda env, same code.
The relevant part of my code, simplified, looks like:
async def act(self):
    element = self.element
    async def get_action():
        tag_name = await self.page.evaluate(
            'elem => { return elem.tagName.toLowerCase(); }',
            element)
        action = None
        if tag_name == 'a':
            action = element.click()
        else:
            action = async_pass()
        return action
    async def get_action_future():
        # gather syntax based on:
        # https://miyakogi.github.io/pyppeteer/reference.html#pyppeteer.page.Page.click
        action = await get_action()
        future_action = asyncio.gather(
            action,
            asyncio.sleep(0.001),  # dirty, dirty work-around, doesn't work nicely otherwise
        )
        waited_future = await asyncio.shield(future_action)
        if waited_future[0] is None:
            await self.page.waitForNavigation(self.wait_options)
        return None
    await get_action_future()
It runs fine on my Windows machine. When I start it on a Linux machine, it starts off OK, whether there's navigation or not. Then, after a few navigation clicks, I'm getting a timeout, then another error:
Error encountered: Navigation Timeout Exceeded: 20000 ms exceeded.
# then I trigger the element selector and the act method again, wrapped in try/except
Error encountered: Protocol Error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
I'm stuck on this problem for a while and would appreciate any help!
My environment includes:
python=3.6, pyppeteer=0.0.25.
BTW:
I noticed that this question has a similar error. BUT, the error is different (Protocol error (Page.navigate): Target closed instead of Protocol Error (Runtime.callFunctionOn)), as well as the environment (node.js, Puppeteer, etc.).
 
    