Protocol error (Runtime.callFunctionOn) on remote debugger
See original GitHub issueIssue I’m having this strange exception, which seems to happen randomly, shortly after making the connection.
Exception “Protocol error (Runtime.callFunctionOn): Session closed. Most likely the Page has been closed.Close reason: The remote party closed the WebSocket connection without completing the close handshake.”
Stacktrace " at PuppeteerSharp.CDPSession.SendAsync(String method, Object args, Boolean waitForCallback) at PuppeteerSharp.CDPSession.SendAsync[T](String method, Object args) at PuppeteerSharp.ExecutionContext.ExecuteEvaluationAsync(String method, Object args) at PuppeteerSharp.ExecutionContext.EvaluateFunctionHandleAsync(String script, Object[] args) at PuppeteerSharp.ElementHandle.XPathAsync(String expression) at PuppeteerSharp.DOMWorld.XPathAsync(String expression)"
This doesn’t happen when i launch the chrome instance within the code itself through Puppeteer.LaunchAsync. This happens only when using a remote chrome debugger like browserless.io in docker.
Reproduction:
-
Start browserless docker container docker run -e “DEFAULT_HEADLESS=false” -p 3000:3000 --restart always -d --name browserless browserless/chrome:1.40-chrome-stable
-
Connect with PuppeteerSharp
var browser = await Puppeteer.ConnectAsync(new ConnectOptions() { BrowserWSEndpoint = "ws://localhost:3000" }); var page = await browser.NewPageAsync();
- Navigate to some arbitrary page and loop random actions like await page.XPathAsync() await (elementHandle).ClickAsync() etc.
In my case, the exception seems to be thrown by either of the actions listed above.
Any suggestions or possible fixes would be greatly appreciated Thanks for building this amazing port!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Apparently browserless kills sessions automatically after 30 seconds. The argument is called “connection timeout”, so i didn’t think this was the issue.
Thanks for your time.
I don’t get any logs on the docker container. But i’m using browserless docker image, so there might be some argument to enable logging. Will look more into that!