mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.03k stars 1.51k forks source link

"Unable to find a matching set of capabilities" when "platformName" is sent upper case #2110

Closed diemol closed 1 year ago

diemol commented 1 year ago

System

We removed JWP support from Selenium Java recently, and this unveiled a case where "session not created: No matching capabilities found" is returned by ChromeDriver when the "platformName" is uppercase. If the "platformName" is sent lowercase, it works. It is not mentioned in the processing capabilities section of WebDriver, but I believe "platformName" matching should ignore case.

I've seen this happens when "WINDOWS", "MAC", and "LINUX" are sent.

Related Selenium issue https://github.com/SeleniumHQ/selenium/issues/11946

For now, I've changed the code in Java to send the platformName lowercase, but I believe this should be looked at.

Thanks!

Testcase

Start GeckoDriver locally:

./geckodriver --port 9515 --log trace
1683198340322   geckodriver INFO    Listening on 127.0.0.1:9515

Post the following payload to http://localhost:9515/session

{
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "firefox",
    "platformName": "MAC"
      }
    ]
  }
}

Stacktrace

{
    "value": {
        "error": "session not created",
        "message": "Unable to find a matching set of capabilities",
        "stacktrace": ""
    }
}

Trace-level log

geckodriver --port 9515 --log trace
1683198340322   geckodriver INFO    Listening on 127.0.0.1:9515
1683198343401   webdriver::server   DEBUG   -> POST /session {
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "firefox",
                "platformName": "MAC"
      }
    ]
  }
}
1683198343407   webdriver::server   DEBUG   <- 500 Internal Server Error {"value":{"error":"session not created","message":"Unable to find a matching set of capabilities","stacktrace":""}}
diemol commented 1 year ago

Folks in ChromeDriver replied to this and pointed out that it needs to be lower case. Closing.

https://bugs.chromium.org/p/chromedriver/issues/detail?id=4441#c2