SeleniumHQ / SeleniumHQ/selenium
[π Feature]: Implement high level BiDi script commands
- Dominant language
- Java
- Stars
- 34.5k
- Forks
- 8.7k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 92
Description
### Feature and motivation
At the Selenium Dev Summit we agreed on this API to be generally applied across the bindings; we'll keep this labeled beta while we make sure that it works for what is needed
We want the methods to be accessible from a `script()` method available directly from the `Driver` class (e.g., `driver.script.pin(script)`, `driver.Script().Pin(script)`). We can't do everything just like this in all the languages, because, for example, .NET uses events with a `+=` and `-=` for adding and removing handler events so we don't went "add" and "remove" methods.
### Implementations:
| Method | Java | NodeJS | Python | Ruby | .NET |
|--------------------------------------------|------|--------|--------|------|------|
| `pin()` | β
~#14305~ |β
~#14250~ | β
~#15936~ | | |
| `unpin()` | β
~#14305~ | β
~#14250~ | β
~#15936~ | | |
| `execute()` |β
~#14330~ | β
~#14293~| β
~#15936~ | | |
| `addConsoleMessageHandler()` | β
~#14225~ | β
~#14135~ | β
~#14107~ | β
~#14073~ | #14057 |
| `removeConsoleMessageHandler()` | β
~#14225~ | β
~#14135~ | β
~#14107~ | β
~#14073~ | #14057 |
| `addDomMutationHandler()` | β
~#14304~ |β
~#14238~ | | | |
| `removeDomMutationHandler()` | β
~#14304~ | β
~#14238~ | | | |
| `addJavaScriptErrorHandler()` | β
~#14225~ |β
~#14135~ | β
~#14107~ | β
~#14073~ | #14057 |
| `removeJavaScriptErrorHandler()` | β
~#14225~ | β
~#14135~ | β
~#14107~ | β
~#14073~ | #14057 |
### Considerations
* some of these "script" methods are in the "log" domain in BiDi spec, but "log" is overloaded and we were concerned that it would not be obvious what `driver.log()` was supposed to give access to. As such we agreed it would work well in the `Script` implementation
* we agreed to split out console messages from javaScript errors even though both come through the same BiDi method
* we agreed not to have an async version of execute method in the BiDi API
Contributor guide
Assessment
This issue has not been assessed yet.