SeleniumHQ / SeleniumHQ/selenium

[πŸš€ Feature]: Implement high level BiDi script commands

Open
#13,992 11 comments 0 reactions 0 assignees View on GitHub
B-devtools C-dotnet C-py C-rb I-enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.