Chrome offers a WebSocket based API they call the Chrome DevTools Protocol. This API is what allows web development tools to build integrations, and tools such as Selenium to perform their automation.
This is the source for the @open-policy-agent/opa-wasm NPM module which is a small SDK for using WebAssembly (wasm) compiled Open Policy Agent Rego policies.