webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

Having only "alwaysMatch" but no "firstMatch" capabilities doesn't work as defined

Open foolip opened this issue 5 years ago • 0 comments

It looks like there's a bug in https://w3c.github.io/webdriver/#dfn-capabilities-processing.

The "alwaysMatch" capabilities are extracted into a required capabilities variable, while the "firstMatch" capabilities array are extracted into a all first match capabilities variable. That list is turned into a validated first match capabilities.

Then comes the bug.

The merged capabilities is constructed from validated first match capabilities, but if that's an empty list, merged capabilities will also be empty and we will reach "Return success with data null."

That should cause https://w3c.github.io/webdriver/#new-session to fail at the following step, "If capabilities’s is null, return error with error code session not created.", but that's not what should happen.

Suggested fix: If merged capabilities is an empty list, append required capabilities to it.

foolip avatar Jun 04 '20 10:06 foolip