Protractor: Element Explorer totally unresponsive

Created on 25 Jan 2017  路  32Comments  路  Source: angular/protractor

  • Node Version: 7.4.0
  • Protractor Version: 5.0.0
  • Browser: Chrome
  • OS: Windows 7 64bit

I'm following the guide here for setting up a REPL, which says to run protractor thusly: protractor --elementExplorer. I do this, it launches a Chrome window, shows output in the console that suggests everything worked (e.g. "server started...", "debugger listening.."), and leaves me at a prompt (>).

Nothing I type in this prompt produces any effect/response at all. I tried the examples given, such as browser.get('http://www.angularjs.org'), but pressing ENTER simple adds a carriage return to the screen and nothing else. I can keep hitting ENTER and the cursor keeps dropping down a line, but there is no response from protractor, nothing happens in the browser, etc. The only thing that produces a response is CTRL+C or CTRL+D, which serve to let me know the process is still running but that's about it.

protractor-element-explorer

Note, if I keep trying to enter commands (they just pile up with no response), I eventually get this:

(node:3012) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 break listeners added. Use emitter.setMaxListeners() to increase limit

Most helpful comment

Thanks @seanmay, yeah I think that'll do it. I still want to understand element explorer a little bit better and where these paths originally came from, but I'll probably end up doing a fix like that.

Thanks for your patience everyone! We're planning on doing a 5.1.2 release tomorrow, and the fix for this should be included.

All 32 comments

Happening to me also.

Any thoughts ?

Here is the console:

c:>protractor --troubleshoot --elementExplorer
[19:03:26] D/launcher - Running with --troubleshoot
[19:03:26] D/launcher - Protractor version: 5.1.1
[19:03:26] D/launcher - Your base url for tests is undefined
[19:03:26] D/local - Attempting to find the SeleniumServerJar in the default location used by webdriver-manager
[19:03:26] D/local - Attempting to find the chromedriver binary in the default location used by webdriver-manager
[19:03:26] I/local - Starting selenium standalone server...
[19:03:28] I/local - Selenium standalone server started at http://10.250.228.108:62813/wd/hub
[19:03:31] D/runner - WebDriver session successfully started with capabilities Capabilities {
'applicationCacheEnabled' => false,
'rotatable' => false,
'mobileEmulationEnabled' => false,
'networkConnectionEnabled' => false,
'chrome' => { chromedriverVersion: '2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9)',
userDataDir: 'C:\Users\adili\AppData\Local\Temp\scoped_dir9452_11406' },
'takesHeapSnapshot' => true,
'pageLoadStrategy' => 'normal',
'databaseEnabled' => false,
'handlesAlerts' => true,
'hasTouchScreen' => true,
'version' => '56.0.2924.87',
'platform' => 'XP',
'browserConnectionEnabled' => false,
'nativeEvents' => true,
'acceptSslCerts' => true,
'webdriver.remote.sessionid' => '4e429474-b461-4801-b186-d6f53d44eb94',
'locationContextEnabled' => true,
'webStorageEnabled' => true,
'browserName' => 'chrome',
'takesScreenshot' => true,
'javascriptEnabled' => true,
'cssSelectorsEnabled' => true,
'unexpectedAlertBehaviour' => '' }
[19:03:31] D/runner - Running with spec files
[19:03:33] I/protractor -
[19:03:33] I/protractor - ------- Element Explorer -------
[19:03:33] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report
issues at github.com/angular/protractor
[19:03:33] I/protractor -
[19:03:33] I/protractor - Type to see a list of locator strategies.
[19:03:33] I/protractor - Use the list helper function to find elements by strategy:
[19:03:33] I/protractor - e.g., list(by.binding('')) gets all bindings.
[19:03:33] I/protractor -
Starting debugger agent.
Debugger listening on [::]:5858

list(by.binding(''))

..... nothing happens here.....

Same problem here!

Same.

Node Version: 7.5.0
Protractor Version: 5.1.1
Browser: Chrome
OS: Windows 10 64bit

Has anyone found a solution or workaround?

Yes, I would like to know if there is a solution or work around. Same problem here.

Node Version: 6.9.4
Protractor Version: 5.1.1
Browser: Chrome 57.0.2987.110 (64-bit)
OS: Windows 7 Professional 64-bit, Build 7601 Service Pack 1

Same here: no response after entering any command..

I'm at
Protractor: 5.1.1
Node: 6.9.5
Chrome: 56.0.2924.87
OS: Windows 10 Enterprise

So I see the problem is only in windows, do a test in Ubuntu and the problem does not occur.

Bug Report

  • Node Version: 6.10.2
  • Protractor Version: 5.1.1
  • Browser(s): chrome
  • Operating System and Version : Windows 10 and 8.1

Try Elementor but I do not like it very much

I have the same problem. If anyone found the solution please share.

  • Node Version : v6.10.1
  • Protractor Version : 5.1.1
  • Browser Chrome : 53.0.2785.116 (Official Build) m (32-bit)
  • OS : Windows 7

When will this be fixed for Windows?

Why is it taking such a long time (3 months now) to even get a reaction? This is not working at all on windows... Of course I have the exact same issue, what could be causing this?

Hi; sorry, this is new to me. The reality is that while people are still here and helping out, mostly with the tracker, it's just me doing serious work in the system at the moment, and I'm newer to the project than this issue is - and I've been buried in some changes to buffer the impending deprecation of features by 3rd-party dependencies; ideally without breaking the types of TypeScript users, in a phased approach.

It looks like the issue was submitted by testing in the CMD prompt; have any of you tried doing this in PowerShell? In Git's Bash shell? Have any of you tried doing this in the Ubuntu Bash shell in Windows 10 with dev-mode turned on?

@seanmay I tried it in powershell and ConEmu in windows. ElementExplorer, completely hangs upon typing any command

Is it also possible to test in Git's Bash?
I'm sure it's going to work in Ubuntu in Windows, and expecting everyone to run it there is a bridge too far.

I'm trying to discern whether this is a filepath / separator / et cetera issue... beyond that, I still need to figure out where to look; ideally, not before I know what I'm looking for.

Git bash has the same issue...

Okay, so general Windows issue...

Are we all talking about AngularJS (1.X)?

I'm not, but I don't think that matters. Just firing up elementExplorer
and then pressing tab or any command doesn't work. Pressing return after a
command just adds a newline instead of executing it.

I'm not, but I don't think that matters. Just firing up elementExplorer
and then pressing tab or any command doesn't work. Pressing return after a
command just adds a newline instead of executing it.

In my case, pressing tab or any command just makes the elementExplorer unresponsive, it doesn't go to a new line.

But by this time, Protractor will have attempted to load and inject itself onto the page. Tabbing or accessing elements might well be inconsequential in that regard, if there are promises where the error gets swallowed, or similar.

@seanmay This used to work earlier, pressing Tab displayed command suggestions/auto complete options.
I'm sure this got broken in one of the newer versions.

I am tabbing and getting auto-completion options, in Windows 10. I'm also getting hanging and the Node subscription error, after hitting newlines multiple times. I'm also getting it on Angular (4.X), I have yet to test it on AngularJS.

I had the same problem and I have tried to debug it. When running element explorer like this:
node binprotractor --elementExplorer
whatever I typed was ignored, except protractor specific commands like .help, .exit and such. Then I traced the problem to this line: https://github.com/angular/protractor/blob/master/lib/debugger/modes/commandRepl.js#L113
I added some logging like this: https://gist.github.com/Ph0ndragX/dcaa289173b269f12a84f41adbe926a6
and it displayed:

Starting debugger agent.
Debugger listening on [::]:5858
> 2+2
Expression to evaluate: browser.debugHelper.dbgCodeExecutor.execute("2+2")
Evaluation response: No frames

If that expression had been correctly evaluated then the debugger would hit the breakpoint and _onbreak callback (definied in commandRepl.js above) would be executed displaying some results. Unfortunately, I do not know enough about javascript to figure out why there is "No frames" error.

What's more protractor uses nodejs' _debugger which uses deprecated v8 json debugger protocol, so there isn't much documentation I could find. Nodejs has lately moved on from that debugger, so this might be a change worth looking into.

Anyway, I hope this will help in finding out why the element explorer is not working. Anyone, that has this problem might try to use the snippet I provided to find out if they have the same "No frames" error.

I've done a little more digging, and it looks like there are permission errors opening the selenium.jar file, which depending on how Protractor was run (and the state of the rest of your box) might well be the underlying culprit.

I've also done some tests... When I run the node debugger, create a client and let it connect to itself then it works:

D:\>node debug test.js
< (node:8560) DeprecationWarning: node --debug is deprecated. Please use node --inspect instead.
< Debugger listening on 127.0.0.1:5858
debug>  ok
break in D:\test.js:2
  1
> 2 });
debug> var d = require('_debugger');
debug> var client = new d.Client();
debug> client.connect(5858, 'localhost');
-- response cut --
debug> client.req({command: 'evaluate', arguments: {frame: 0, maxStringLength: 1000, expression: '2+2'}}, function(e, r) { console.log(r); });

unhandled res:{"seq":6,"request_seq":1,"type":"response","command":"evaluate","success":true,"body":{"handle":77,"type":"number","value":4,"text":"4"},"refs":[],"running":false}
debug> { handle: 77, type: 'number', value: 4, text: '4' }

Running protractor

D:\>protractor --elementExplorer
(node:13408) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[12:39:09] I/local - Starting selenium standalone server...
[12:39:10] I/local - Selenium standalone server started at http://134.188.186.220:53993/wd/hub
[12:39:12] I/protractor -
[12:39:12] I/protractor - ------- Element Explorer -------
[12:39:12] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report issues at github.com/angular/protractor
[12:39:12] I/protractor -
[12:39:12] I/protractor - Type <tab> to see a list of locator strategies.
[12:39:12] I/protractor - Use the `list` helper function to find elements by strategy:
[12:39:12] I/protractor -   e.g., list(by.binding('')) gets all bindings.
[12:39:12] I/protractor -
Starting debugger agent.
(node:13408) DeprecationWarning: node --debug is deprecated. Please use node --inspect instead.
Debugger listening on 127.0.0.1:5858
>

and then doing the exact same thing as before from another cmd window:

D:\>node
> var d = require('_debugger');
undefined
> var client = new d.Client();
undefined
> client.connect(5858, 'localhost');
-- response cut --
> client.req({command: 'evaluate', arguments: {frame: 0, maxStringLength: 1000, expression: '2+2'}}, function(e, r) { console.log(r); });
undefined
> { seq: 6,
  request_seq: 1,
  type: 'response',
  command: 'evaluate',
  success: false,
  message: 'No frames',
  running: true }

So, in some way, running the debugger server through protractor works different from running it separately?

I don't know how this would look on a working system, but it appears that the VM is still running after the request so it hasn't hit a break point (and therefore also doesn't have any frames?). In fact it looks like it only hits an initial breakpoint (maybe when attaching the debugger?) and then issues a reqContinue. Isn't it supposed to end up in a breakpoint each time?

Ok, @seanmay, I finally found it ... debuggerCommons contains this function:

exports.setEvaluateBreakpoint = function(client, cb) {
  client.setBreakpoint({
    type: 'scriptRegExp',
    target: 'built/breakpointhook\.js', //jshint ignore:line
    line: 2
  }, function(err, response) {
    if (err) {
      throw new Error(err);
    }
    cb(response.breakpoint);
  });
};

Unfortunately the regex for the script doesn't work on windows ... removing 'built/' makes elementExplorer work as expected!

@woppa684 Thanks for debugging! Can you try out #4257 and see if it fixes the problem?

@heathkit It doesn't work ... are you sure the path.join correctly escapes that part for usage in a regex?

Right, of course it doesn't. I'll take another look at it later and see how important it is that we include 'built/' and whether we can just drop it.

@woppa684 : Thank you so much for the fix. It works :+1:

@heathkit I haven't returned to it to validate it on the PC, but I believe something like:

function prepareDebuggerURL (parts) {
  path.join(parts)
    .replace(/\\/g, "\\")
    .replace(/\./g, "\.");
}

prepareDebuggerURL(["built", "breakpointhoook.js"])

ought to work. Same deal for "lib/http.js".

Thanks @seanmay, yeah I think that'll do it. I still want to understand element explorer a little bit better and where these paths originally came from, but I'll probably end up doing a fix like that.

Thanks for your patience everyone! We're planning on doing a 5.1.2 release tomorrow, and the fix for this should be included.

Was this page helpful?
0 / 5 - 0 ratings