protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Element explorer doesn't work on Node 8

Open monkpit opened this issue 9 years ago • 65 comments

Bug report

  • Node Version: 8.0.0
  • Protractor Version: 5.1.2
  • Angular Version: n/a
  • Browser(s): Chrome / chromedriver 2.29.0
  • Operating System and Version Mac Sierra 10.12.5
  • Your protractor configuration file n/a

After installing node v8.0.0 and npm v5.0.0, reinstalling protractor globally and running webdriver-manager update, I cannot run protractor --elementExplorer because I receive the following error:

protractor --elementExplorer
(node:76684) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[11:04:10] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[11:04:11] I/protractor -
[11:04:11] I/protractor - ------- Element Explorer -------
[11:04:11] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report issues at github.com/angular/protractor
[11:04:11] I/protractor -
[11:04:11] I/protractor - Type <tab> to see a list of locator strategies.
[11:04:11] I/protractor - Use the `list` helper function to find elements by strategy:
[11:04:11] I/protractor -   e.g., list(by.binding('')) gets all bindings.
[11:04:11] I/protractor -
module.js:487
    throw err;
    ^

Error: Cannot find module '_debugger'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/protractor/built/debugger/debuggerCommons.js:1:82)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

If I revert back to node 7.10.0 I don't get this error.

monkpit avatar Jun 01 '17 16:06 monkpit

I don't think we are currently testing against node 8 so it makes sense that this may be broken. Thanks for bringing this up!

NickTomlin avatar Jun 01 '17 18:06 NickTomlin

I'll try to dig into this in the next few days but a PR to fix this would be very welcome!

NickTomlin avatar Jun 01 '17 18:06 NickTomlin

_debugger and the legacy CLI debugger were removed in Node 8: https://github.com/nodejs/node/commit/90476ac6ee

monkpit avatar Jun 01 '17 18:06 monkpit

Any updates on this?

GvS666 avatar Jun 28 '17 07:06 GvS666

Could we please know what are the plans for Node 8 support? :)

bakasmarius avatar Jul 25 '17 14:07 bakasmarius

With Node v8 set to enter LTS in October, maybe we could get an update?

https://github.com/nodejs/LTS#lts-schedule1

will-l-h avatar Aug 26 '17 17:08 will-l-h

According to https://nodejs.org/en/docs/guides/debugging-getting-started/#legacy-debugger , the node.js team is migrating users to the new inspect API.

rodrigc avatar Sep 06 '17 01:09 rodrigc

Are there plans from the team to get this working again with either the inspect API or something other approach?

uriah-ascend avatar Oct 06 '17 14:10 uriah-ascend

Same error https://github.com/node-inspector/node-inspector/issues/1025#issuecomment-339202842 4 month already

Also https://stackoverflow.com/questions/44662442/node-inspector-not-starting

wzup avatar Oct 25 '17 03:10 wzup

I've started having a look into this. Here are a bunch of guesses about how updating this might work:

As far as I can tell, the changes need to happen in debuggerCommons.js

Rather than require('_debugger'); it needs to use require('inspector'); (docs here). You can then open the inspector, create a session, connect to it, and then use session.post and the Chrome DevTools Protocol to send the messages to add the breakpoints.

I'll have a crack at a PR when I get some time.

phenomnomnominal avatar Nov 03 '17 08:11 phenomnomnominal

@phenomnomnominal Hey that's great! May I know when you are available for making the PR? Since this functionality is so useful, would be great if it can be created soon. It will speed up our development so much. Thanks!

yxliang01 avatar Nov 03 '17 10:11 yxliang01

@phenomnomnominal Hi, we are planing to support node 8.0 recently, what's your current plan of fixing this issue?

qiyigg avatar Nov 06 '17 22:11 qiyigg

Only what I outlined above. I was planning on having a crack at it this evening.

phenomnomnominal avatar Nov 06 '17 23:11 phenomnomnominal

@phenomnomnominal that's great, thanks a lot!

qiyigg avatar Nov 07 '17 00:11 qiyigg

@phenomnomnominal Hi, any updates so far?

qiyigg avatar Nov 12 '17 04:11 qiyigg

I started having a go, but I was having issues with Selenium when trying to run the tests (any tips?). I’m going to have some more time Tuesday night. The new API is quite different, but I don’t foresee any real issues.

phenomnomnominal avatar Nov 12 '17 04:11 phenomnomnominal

ok, thanks a lot. I am supposed to have some time after Monday, maybe I can also look into it after that.

qiyigg avatar Nov 12 '17 06:11 qiyigg

I got... somewhere? Turns out debugging the debugger isn't as straightforward as I'd have hoped. @qiyigg did you have a chance to look at anything?

phenomnomnominal avatar Nov 14 '17 11:11 phenomnomnominal

I will look into it today, thanks!

qiyigg avatar Nov 15 '17 18:11 qiyigg

I’ll have some more time this evening too, we can compare notes later.

phenomnomnominal avatar Nov 15 '17 19:11 phenomnomnominal