Runtime.evaluate problem with recent Chrome/Chromium

61 vistas
Ir al primer mensaje no leído

David Days

no leída,
5 nov 2023, 2:54:21 p.m.5/11/2023
para Chrome DevTools
Hello all,

I'm maintaining a testing framework that we've been using to evaluate our web UI, based on a fork of https://github.com/MasterDevs/ChromeDevTools.   To catch up with some of the security fixes, I've had to update our headless chrome executables to the latest(ish) versions.

After getting through the argument changes and the newer options available, I have one last issue I just can't figure out:  When I true to run a simple JS expression such as document.body.outerHTML I always get the same response:

{
  "id": 13,
  "error": {
    "code": -32000,
    "message": "Execution was terminated"
  }
}


I always execute Runtime.enable before trying to run this, and I've specified execution context ids, frame id values, and attached to targets, as well as tried various suggested combinations of the options.

Finally, I installed Selenium to run the same setup and eavesdropped using Wireshark, and noticed that Selenium is getting the session Id early on from the Target.attachToTarget response and sending that with just about every command.  I tried to do the same, and now the only difference is that I get the sessionId echoed back (just like in Selenium) like so:

{
  "id": 13,
  "error": {
    "code": -32000,
    "message": "Execution was terminated"
  },
  "sessionId": "086FCC1BC3D0825D2B2C1A08742190CD"
}


I've also dug through all the command line switches and options I could find (in case there's some security setting I'm unaware of), to no avail.  In the interest of thoroughness, this is the script I'm using on Linux to run the downloaded chrome package:

#!/bin/bash
./chrome-linux/chrome --remote-debugging-port=9720  --disable-gpu --bwsi --no-first-run --enable-automation --disable-notifications --remote-allow-origins=* --disable-client-side-phishing-detection --disable-sync --disable-features=ChromeWhatsNewUI



Aside from digging through the gigs and gigs of Chromium source code, I am at a loss.  Neither "Execution was terminated" nor "-32000" seem to come up anywhere via forum  or  web searches in conjunction with CDP.

I'm open to any suggestions, and would be happy to trade recipes and practical examples for any help.

Thanks in advance,
David

Yang Guo

no leída,
6 nov 2023, 2:33:36 a.m.6/11/2023
para google-chrome-...@googlegroups.com
Hi,

The source of the "Execution was terminated" message is here or here. The reason is likely that you are using the timeout argument for Runtime.evaluate, or something else has triggered a termination of JavaScript execution.

Yang

--
You received this message because you are subscribed to the Google Groups "Chrome DevTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/11007386-9458-4fc4-99db-de4cfda8d6f3n%40googlegroups.com.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos