Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

npm run firefox does not set debugger server #906

Closed
Zacqary opened this issue Oct 9, 2016 · 15 comments
Closed

npm run firefox does not set debugger server #906

Zacqary opened this issue Oct 9, 2016 · 15 comments
Labels

Comments

@Zacqary
Copy link
Contributor

Zacqary commented Oct 9, 2016

Running npm run firefox launches the browser, but the debugger at localhost:8000 doesn't seem to know it exists. The command errors out, so I think that might be the reason.

$ npm run firefox
> [email protected] firefox /Users/Zac/Desktop/debugger.html
> node bin/firefox-driver --start

/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/promise.js:2291
        throw error;
        ^

WebDriverError: Unable to parse new session response: {"error":"unknown error","message":"Missing 'marionetteProtocol' field in handshake"}
    at WebDriverError (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/error.js:27:5)
    at doSend.then.response (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/http.js:335:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/webdriver.js:366:24)
    at createGeckoDriver (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/firefox/index.js:497:27)
    at Driver (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/firefox/index.js:605:14)
    at start (/Users/Zac/Desktop/debugger.html/bin/firefox-driver.js:42:18)
    at Object.<anonymous> (/Users/Zac/Desktop/debugger.html/bin/firefox-driver.js:47:18)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
From: Task: WebDriver.navigate().to(http://localhost:7999/todomvc)
    at Driver.schedule (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/webdriver.js:414:17)
    at Navigation.to (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/webdriver.js:1042:25)
    at Driver.get (/Users/Zac/Desktop/debugger.html/node_modules/selenium-webdriver/lib/webdriver.js:832:28)
    at Object.<anonymous> (/Users/Zac/Desktop/debugger.html/bin/firefox-driver.js:48:10)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)

npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "firefox"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] firefox: `node bin/firefox-driver --start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] firefox script 'node bin/firefox-driver --start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the debugger.html package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node bin/firefox-driver --start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs debugger.html
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls debugger.html
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Zac/Desktop/debugger.html/npm-debug.log
@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 9, 2016

Update: it's working now. I use Firefox Dev Edition for my normal browsing, and the version of vanilla Firefox that I had installed was still at version 41. Updating that seems to have fixed it.

@Zacqary Zacqary closed this as completed Oct 9, 2016
@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 9, 2016

Actually, no, false alarm. Firefox opens the TodoMVC example the way that the debugging version of Chrome does, but it's still not available on localhost:8000 after I restart the debugger server.

@Zacqary Zacqary reopened this Oct 9, 2016
@Zacqary Zacqary changed the title npm run firefox throws "Missing 'marionetteProtocol' field in handshake" error npm run firefox browser is not available in the debugger tabs Oct 9, 2016
@wldcordeiro
Copy link
Contributor

The listen port likely isn't getting configured automatically. Try shift+f2 and type listen 6080 and see if it works

@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 10, 2016

shift+f2 doesn't seem to be doing anything, but I am getting this from the debug server log:

webpack built cbd28cc4ab2b9705a62b in 13712ms
TCP connection failed: Error: connect ECONNREFUSED 127.0.0.1:6080
WS connection closed, disconnected from TCP

@wldcordeiro
Copy link
Contributor

Odd shift+f2 is the devtools cli. Maybe you can open it from the tool button?

@wldcordeiro
Copy link
Contributor

@Zacqary should look like this at the bottom of the browser (I typed in the command.)
screenshot_20161009_204316

@wldcordeiro
Copy link
Contributor

@jasonLaster or @jlongster could you get some additional input here? I don't use this way of running Firefox because I only have m-c and run it as my daily driver 😄

@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 10, 2016

Oh. shift+f2 in the browser, not the terminal. Duh.

listen 6080 does the trick! Still not sure why it's not automatically doing that on launch, though.

@jasonLaster
Copy link
Contributor

Sure. I believe there is an open issue fire Firefox driver leaving out
start debugger server.

At the moment you need to use the CLI option or shift f2.
On Sun, Oct 9, 2016 at 10:54 PM Wellington Cordeiro <
[email protected]> wrote:

@jasonLaster https://github.com/jasonLaster or @jlongster
https://github.com/jlongster could you get some additional input here?
I don't use this way of running Firefox because I only have m-c and run it
as my daily driver 😄


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#906 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPiYjvf0cp9k57fwwDwjRPaJBC6ei06ks5qyajsgaJpZM4KSFWr
.

@jasonLaster jasonLaster changed the title npm run firefox browser is not available in the debugger tabs npm run firefox does not set debugger server Oct 19, 2016
@kareniel
Copy link
Contributor

kareniel commented Nov 6, 2016

I managed to get the driver to set preferences correctly, (confirmed by about:config) but I still need to use listen with GCLI to make the debugger work.

So I thought I would automate that part with selenium with key presses ( 😃 ) but turns out the functions we need for that aren't implement yet in gecko_driver.

const driver = new webdriver.Builder()
  .forBrowser('firefox')
  .withCapabilities(firefoxOptions().toCapabilities().set('moz:firefoxOptions', {
    prefs: {
      "devtools.debugger.remote-port": 6080,
      "devtools.chrome.enabled": true,
      "devtools.debugger.prompt-connection": false,
      "devtools.debugger.remote-enabled": true,
      "devtools.debugger.remote-websocket": useWebSocket
    }
  }))
  .build()

Here's a link to the listen command's source code in mozilla-central in case anyone wants to dig deeper.

@jasonLaster
Copy link
Contributor

Thanks. This is close to my heart. I'd love a fix for this.

I think the challenge is to call gecko driver with the right -b params one
of which is debugger-server. Right now that's not happening :)

This used to work for selenium 2 with non marionette gecko bindings, but
alas that started crashing with Firefox 48...

I could easily be missing something here

Mind explaining what you found a bit more

On Sun, Nov 6, 2016 at 12:47 AM Jonathan Dupre [email protected]
wrote:

I managed to get the driver to set preferences correctly, (confirmed by
about:config) but I still need to use listen with GCLI.

So I thought I would automate that part with selenium with key presses (
😃 ) but turns out the functions we need for that aren't implement yet in
gecko_driver.

const driver = new webdriver.Builder()
.forBrowser('firefox')
.withCapabilities(firefoxOptions().toCapabilities().set('moz:firefoxOptions', {
prefs: {
"devtools.debugger.remote-port": 6080,
"devtools.chrome.enabled": true,
"devtools.debugger.prompt-connection": false,
"devtools.debugger.remote-enabled": true,
"devtools.debugger.remote-websocket": useWebSocket
}
}))
.build()

Here's a link
https://hg.mozilla.org/mozilla-central/file/tip/devtools/shared/gcli/commands/listen.js#l71
to the listen command's source code in mozilla-central in case anyone wants
to dig deeper.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#906 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPiYuVnlizwVz1e0Vxzq9coIF6d0ECZks5q7VvRgaJpZM4KSFWr
.

@jasonLaster
Copy link
Contributor

By the way, it's totally in our control to change m-c if we have a good
fix.
On Sun, Nov 6, 2016 at 12:52 AM Jason Laster [email protected]
wrote:

Thanks. This is close to my heart. I'd love a fix for this.

I think the challenge is to call gecko driver with the right -b params one
of which is debugger-server. Right now that's not happening :)

This used to work for selenium 2 with non marionette gecko bindings, but
alas that started crashing with Firefox 48...

I could easily be missing something here

Mind explaining what you found a bit more

On Sun, Nov 6, 2016 at 12:47 AM Jonathan Dupre [email protected]
wrote:

I managed to get the driver to set preferences correctly, (confirmed by
about:config) but I still need to use listen with GCLI.

So I thought I would automate that part with selenium with key presses (
😃 ) but turns out the functions we need for that aren't implement yet in
gecko_driver.

const driver = new webdriver.Builder()
.forBrowser('firefox')
.withCapabilities(firefoxOptions().toCapabilities().set('moz:firefoxOptions', {
prefs: {
"devtools.debugger.remote-port": 6080,
"devtools.chrome.enabled": true,
"devtools.debugger.prompt-connection": false,
"devtools.debugger.remote-enabled": true,
"devtools.debugger.remote-websocket": useWebSocket
}
}))
.build()

Here's a link
https://hg.mozilla.org/mozilla-central/file/tip/devtools/shared/gcli/commands/listen.js#l71
to the listen command's source code in mozilla-central in case anyone wants
to dig deeper.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#906 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPiYuVnlizwVz1e0Vxzq9coIF6d0ECZks5q7VvRgaJpZM4KSFWr
.

@kareniel
Copy link
Contributor

kareniel commented Nov 6, 2016

gasp I actually have a fix for this now. 😮
Do you want me to explain or make a pull request (I'd be happy to)?

edit: totally sending a pull request right now 😸

@kareniel
Copy link
Contributor

kareniel commented Nov 6, 2016

I dove deep into the issues on Selenium + their js docs & the issues on gecko-driver and found out that the Profile object never gets handed to gecko_driver. I'm not exactly sure why but I think it's because this way of setting options will be deprecated in favor of using Capabilities.

@jasonLaster
Copy link
Contributor

I'll try it out soon.

You succeeded where I failed several times. I've probably spent 10+ hours
debugging selenium internals trying to figure out how to pass the binary
args.

I think you're right about the future being in capabilities. That makes a
ton of sense

It's hard to overstate how helpful this is. It's great to be able to do

npm i;
npm run firefox;
npm start

On Sun, Nov 6, 2016 at 9:36 AM Jonathan Dupre [email protected]
wrote:

I dove deep into the issues on Selenium + their js docs & the issues on
gecko-driver and found out that the Profile object never gets handed to
gecko_driver. I'm not exactly sure why but I think it's because this way of
setting options will be deprecated in favor of using Capabilities.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#906 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPiYnPexBcknGtc6Pnx_J0h-yM4tBBHks5q7eX-gaJpZM4KSFWr
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants