I have a js script which I want to execute in my Java application.
I have tried to use the Chromedriver
API to do this
But it throws the following exception:
I am so confused because the script can simply run with node xx.js
Does this mean the js which uses the global
object cannot execute in a Java application?
CodePudding user response:
According to MDN, global
is Node-specific, so you can't expect to be able to use it if you're not running under Node. They suggest globalThis
as the portable replacement.