firstMatch vs alwaysMatch Capabilities
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 135
- PR merge metrics
- No merged PRs in 30d
Description
Am I correct in assuming that fantoccini only supports sending alwaysMatch?
The ClientBuilder struct itself only provides a way to add "capabilities", which I would have expected follows the webdriver standard: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities
As noted on that page, the general structure looks like this for always match:
```
{
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"browserVersion": "60"
}
}
}
```
And looks like this for first match:
```
{
"capabilities": {
"firstMatch": [
{"platformName": "macos"},
{"platformName": "linux"}
]
}
}
```
And of course, the two can be combined:
```
{
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"moz:firefoxOptions": {
"profile": "",
"args": ["-headless"],
"prefs": {"dom.ipc.processCount": 8},
"log":{"level": "trace"}
}
},
"firstMatch": [
{"platformName": "macos"},
{"platformName": "linux"}
]
}
}
```
But digging in the Session [code](https://github.com/jonhoo/fantoccini/blob/master/src/session.rs#L380-L383) and ClientBuilder [code](https://github.com/jonhoo/fantoccini/blob/master/src/lib.rs#L238-L246), it seems that fantoccini only provides a way of setting: `capabilities` -> `alwaysMatch`.
I was kind of hoping for something more like this:
```
...
let client = ClientBuilder::native()
.with_always_match(always_match_capabilities)
.with_first_match(first_match_capabilities)
.connect(&url)
.await?;
...
```
or alternatively:
```
let client = ClientBuilder::native()
.with_capabilities(r#"""
{
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"moz:firefoxOptions": {
"profile": "",
"args": ["-headless"],
"prefs": {"dom.ipc.processCount": 8},
"log":{"level": "trace"}
}
},
"firstMatch": [
{"platformName": "macos"},
{"platformName": "linux"}
]
}
}
""")
.connect(&url)
.await?;
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the capability handling in src/session.rs around the linked session code and the ClientBuilder implementation in src/lib.rs. Compare the current request structure with the WebDriver capabilities examples in the issue; done means ClientBuilder can represent both alwaysMatch and firstMatch when connecting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100