I am trying to use RDP to automate Firefox, but I could not find a way to evaluate arbitrary JavaScript in the context of current web page. I am looking for a command equivalent to Chrome's Runtime.evaluate.
CodePudding user response:
I don't think Firefox is pursuing the implementation of CDP anymore, and as you already noticed, the Runtime.evaluate
command does not seem to be part of the implemented features. Hard to be 100% sure because the available documentation is very sparse but I tested it and it fails with UnknownMethodError
.
Mozilla is currently pushing for a new protocol: WebdriverBiDi. This new specification should bridge the gap between the REST-based Webdriver protocol and the newly emerged Websocket-based DevTools protocol (more flexible and efficient). It will be a Websocket-based protocol and the good news is that Google, Mozilla, Apple and other major players are part of it. Hopefully, this will emerge as a real standard like Webdriver became.
Given the current draft of the spec, I would say that script.evaluate
should be the command you will be waiting for... I have no idea when it will get there though.