Webdriver Returning Unknown Error instead of Unknown Command for JWP

Confirmed Issue #19917561 • Assigned to Stanley H.

Details

Author
Dylan R.
Created
Dec 12, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

Scenario:

When MicrosoftWebdriver is running in W3C Mode, and receives a JSON Wire Protocol command such as /execute

Expected Behavior:

It should return back 404 - Unknown Command
https://w3c.github.io/webdriver/#dfn-unknown-command

Actual Behavior:

It returns back 500 - Unknown Error.

Versions:

MicrosoftWebDriver Version 10.0.17763.1
Microsoft Edge 44.17763.1.0
Microsoft EdgeHTML 18.17763
Windows 10 build 1809

Extra Detail

This is a part of https://github.com/SeleniumHQ/selenium/issues/6464 - Webdriverio is sending the /execute json protocol command by default. If it receives back unknown command, it’s designed to try the w3c protocol. However, it’s getting back unknown error.
https://github.com/webdriverio-boneyard/v4/blob/767a0cb7796c0635034bfe991fa851ff6f711ff1/lib/protocol/execute.js#L63-L65

Replication Steps

  1. Launch MicrosoftWebdriver in w3c mode
  2. Start a session
  3. Send it POST /session/<SessionID>/execute

See the attached log, in which it clearly indicates it’s getting a json wire protocol command, but its response is Unknown error.

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Zachariah L.”

  • Hi Dylan!

    Thank you for contacting us regarding this problem! Given the information provided, I was unable to replicate the issue. In order to confirm this as a MicrosoftWebDriver problem, could you please provide me a sample project or code snippet which reproduces this error?

  • Microsoft Edge Team

    Changed Status to “Not reproducible”

  • At this time I will close out this issue. If you are still able to reproduce this issue please provide the details I requested and I will resume investigating this issue. 

    Best regards,​
    The Microsoft Edge Team. ​

  • @Zachariah My apologies - emails were not delivered to me.

    I was still able to replicate this. Please ensure MicrosoftWebDriver is running in w3c mode, and you’re making a POST request to /execute, not /execute/sync.

    Version

    MicrosoftWebDriver Version 10.0.17763.1

    To Replicate:

    1. In a command line prompt, run:
    MicrosoftWebDriver --w3c
    
    1. In a powershell prompt:
      Note: Replace the url port with the one MicrosoftWebDriver started with
    Invoke-WebRequest -Uri http://127.0.0.1:17556/session -Method Post -Body "{`"desiredCapabilities`":{`"browserName`":`"MicrosoftEdge`",`"version`":`"`"},`"capabilities`":{`"firstMatch`":[{`"browserName`":`"MicrosoftEdge`"}]}}" -UseBasicParsing
    
    1. In a powershell prompt:
      Note: Replace the url port and with the one microsoft started with
    Invoke-WebRequest -Uri http://127.0.0.1:17556/session//execute -Method Post -Body "{`"script`":`"console.log('hello');`",`"args`":[]}" -UseBasicParsing
    

    Expected Response:

    Unknown Command

    Actual Response:

    Unknown Error

    Full output:

    C:\Users\selenium>MicrosoftWebDriver --w3c
    [03:43:44.888] - Listening on http://127.0.0.1:17556/
    [03:43:44.888] - Listening on http://[::1]:17556/
    
    
    PS C:\Users\selenium> Invoke-WebRequest -Uri http://127.0.0.1:17556/session -Method Post -Body "{`"desiredCapabilities`":{`"browserName`":`"MicrosoftEdge`",`"version`":`"`"},`"capabilities`":{`"firstMatch`":[{`"browserName`":`"MicrosoftEdge`"}]}}" -UseBasicParsing
    
    
    StatusCode        : 200
    StatusDescription : OK
    Content           : {"value":{"sessionId":"37A6B759-8C16-4D81-8359-2527B5762249","capabilities":{"acceptInsecureCerts":false,"browserName":"MicrosoftEdge","browserVersion":"44.17763.1.0","pag
                        eLoadStrategy":"normal","plat...
    RawContent        : HTTP/1.1 200 OK
                        Content-Length: 314
                        Content-Type: application/json;charset=UTF-8
                        Date: Tue, 19 Feb 2019 03:44:42 GMT
                        Server: Microsoft-HTTPAPI/2.0
    
                        {"value":{"sessionId":"37A6B759-8C16-4D81-8359...
    Forms             :
    Headers           : {[Content-Length, 314], [Content-Type, application/json;charset=UTF-8], [Date, Tue, 19 Feb 2019 03:44:42 GMT], [Server, Microsoft-HTTPAPI/2.0]}
    Images            : {}
    InputFields       : {}
    Links             : {}
    ParsedHtml        :
    RawContentLength  : 314
    
    PS C:\Users\selenium> Invoke-WebRequest -Uri http://127.0.0.1:17556/session/37A6B759-8C16-4D81-8359-2527B5762249/execute -Method Post -Body "{`"script`":`"console.log('hello');`",`"args`":[]}" -UseBasicParsing
    Invoke-WebRequest : Unknown error
    
  • Microsoft Edge Team

    Changed Assigned To to “Zachariah L.”

    Changed Status from “Not reproducible”

  • Hi Dylan!

    No worries, I didn’t get a notification for this issue either.

    Using your reproduction steps, I was able to reproduce this issue. Thank you for the very detailed reproduction, it was very helpful.

    Zach

  • Microsoft Edge Team

    Changed Assigned To to “edgedevtoolstri”

    Changed Assigned To from “edgedevtoolstri” to “Zachariah L.”

    Changed Assigned To to “edgedevtoolstri”

    Changed Assigned To from “edgedevtoolstri” to “Stanley H.”

    Changed Status to “Confirmed”

  • I have assigned this issue to a developer to take a look. We are hesitant to take changes to the driver given our move to Chromium and being focused on that; however, if the fix is not very risky, we’ll take it.

  • @John Thanks! In the meantime, we had to fork Selenium and force the driver into --jwp mode since WebDriverIO 4.0 isn’t retrying the request for w3c due to the wrong error being returned.

You need to sign in to your Microsoft account to add a comment.

Sign in