Closed Bug 1669218 Opened 4 years ago Closed 4 years ago

Return the "moz:debuggerAddress" as part of the capabilities when opted-in for Remote Agent

Categories

(Testing :: geckodriver, enhancement, P1)

Default
enhancement

Tracking

(firefox85 fixed)

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Regressed 1 open bug, )

Details

Attachments

(1 file)

Similar to chromedriver that returns the address as part of the capabilities:

An address of a Chrome debugger server to connect to, in the form of <hostname/ip:port>, e.g. '127.0.0.1:38947'

Summary: Return "debuggerAddress" as part of the capabilities for websocket to Remote Agent → Return "moz:debuggerAddress" as part of the capabilities for websocket to Remote Agent

To enable the remote agent currently two command line arguments are supported. See also bug 1669230 in what we might want to unify.

I think that we should use --remote-debugging-port to start the remote agent, similar to what Puppeteer makes use of. Then we would have to retrieve the debugger URL from the error log. Not sure how easy that part will actually be, and if there might be a race condition.

See Also: → 1669230

Also I would vote to not enable the remote agent by default for a new webdriver session but always make it opt-in.

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #2)

Also I would vote to not enable the remote agent by default for a new webdriver session but always make it opt-in.

How would you opt in to it? How simple would it be?

It's important for the webdriver-bidi stuff that it's a case of "upgrading" so it can't be restarting the browser. People may update their tests to use the new Selenium Bidi APIs which try connect to a websocket at that point. People likely wouldn't want to send through a new capability.

We will most likely have a moz:firefoxOptions capability that needs to be set to enable the Remote Agent like that:

moz:firefoxOptions: {
  webSocketURL: true,  // defaults to false
}

When the option is set to true geckodriver will enable both Marionette and the Remote Agent when starting Firefox. Once a new session has been started the capabilities as returned by geckodriver would look somewhat like the following:

{
  "value": {
    "sessionId":"62f8a221-a1c4-cf46-8440-cd99806fa6c3",
    "capabilities": {
      "acceptInsecureCerts":false, 
      "moz:webSocketURL": "ws://localhost:9222", 
      ... 
    }
  }
}

I would have to check with Chrome first what debuggerAddress and webSocketDebuggerUrl actually are to give a clear answer in how the property names would look like. But as reading the Selenium code we would need the webSocketDebuggerUrl.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Priority: P2 → P1
Summary: Return "moz:debuggerAddress" as part of the capabilities for websocket to Remote Agent → Return the webSocketURL as part of the capabilities when opted-in for Remote Agent

Before we can actually go ahead with this opt-in feature I would like to make sure that we don't ship with regressions in our or Firefox' code. As such I would like to see the Puppeteer jobs running per commit (bug 1628589). This should give us more confidence for the stability of our code.

Depends on: 1628589

Why are we making this opt-in? Selenium bindings are likely to just turn it on as default in the bindings.

Flags: needinfo?(hskupin)

Selenium can obviously turn it on by default at their discretion, but I don't think it makes any sense to auto-start an additional server without some indication that the client is actually going to do something with that server. And doubly so for an implementation of a proprietary protocol.

Could we also include the version of CDP that you are supporting? We get this info when we get via the http request when asking for the webSocketURL in the following Selenium code

(In reply to David Burns :automatedtester from comment #8)

Could we also include the version of CDP that you are supporting? We get this info when we get via the http request when asking for the webSocketURL in the following Selenium code

Yes, the version endpoint is already available for a long time:
https://searchfox.org/mozilla-central/source/remote/JSONHandler.jsm#22-24

We only might have to figure out how/when to update the version value.

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #4)

We will most likely have a moz:firefoxOptions capability that needs to be set to enable the Remote Agent like that:

moz:firefoxOptions: {
  webSocketURL: true,  // defaults to false
}

This isn't going to work given that it shouldn't be a Firefox option but a capability. As such I will add a moz:webSocketUrl flag to the capabilties, and it will return "moz:webSocketUrl":"localhost:9222" as part of the returned capabilities. With that the code in Selenium should just work.

Flags: needinfo?(hskupin)
Blocks: 1669746
Depends on: 1669698
Depends on: 1671205

If set to true geckodriver will start Firefox with the
Remote Protocol enabled by using the --remote-debugging-port=0
command line argument.

The returned capabilities by the New Session command will
contain moz:debuggerAddress that holds the "host:port"
of the HTTP server to query for debuggable websocket
connections.

Blocks: 1668243
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bd8ae5a00b8e [geckodriver] Add "moz:debuggerAddress" capability to offer an opt-in for the Remote Protocol. r=webdriver-reviewers,jgraham
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
Summary: Return the webSocketURL as part of the capabilities when opted-in for Remote Agent → Return the "moz:debuggerAddress" as part of the capabilities when opted-in for Remote Agent
Regressions: 1677750
Regressions: 1849672
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: