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