Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Element Explorer totally unresponsive #4011

Closed
EricTetz opened this issue Jan 25, 2017 · 32 comments
Closed

Element Explorer totally unresponsive #4011

EricTetz opened this issue Jan 25, 2017 · 32 comments

Comments

@EricTetz
Copy link

EricTetz commented Jan 25, 2017

  • 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

@adil060606
Copy link

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.....

@rodwill
Copy link

rodwill commented Feb 15, 2017

Same problem here!

@aidanmischke
Copy link

Same.

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

@sylvain-hamel
Copy link

Has anyone found a solution or workaround?

@cyclismo
Copy link

cyclismo commented Mar 27, 2017

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

@deKaantje
Copy link

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

@isortegah
Copy link

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

@swathivalluri
Copy link

swathivalluri commented Apr 6, 2017

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

@sushantwingified
Copy link

When will this be fixed for Windows?

@woppa684
Copy link

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?

@seanmay
Copy link
Contributor

seanmay commented Apr 26, 2017

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?

@sushantwingified
Copy link

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

@seanmay
Copy link
Contributor

seanmay commented Apr 26, 2017

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.

@woppa684
Copy link

woppa684 commented Apr 26, 2017 via email

@seanmay
Copy link
Contributor

seanmay commented Apr 26, 2017

Okay, so general Windows issue...

@seanmay
Copy link
Contributor

seanmay commented Apr 27, 2017

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

@woppa684
Copy link

woppa684 commented Apr 27, 2017 via email

@sushantwingified
Copy link

sushantwingified commented Apr 27, 2017

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.

@seanmay
Copy link
Contributor

seanmay commented Apr 27, 2017

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.

@sushantwingified
Copy link

@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.

@seanmay
Copy link
Contributor

seanmay commented Apr 27, 2017

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.

@Ph0ndragX
Copy link

Ph0ndragX commented Apr 27, 2017

I had the same problem and I have tried to debug it. When running element explorer like this:
node bin\protractor --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.

@seanmay
Copy link
Contributor

seanmay commented Apr 27, 2017

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.

@woppa684
Copy link

woppa684 commented May 1, 2017

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?

@woppa684
Copy link

woppa684 commented May 2, 2017

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?

@woppa684
Copy link

woppa684 commented May 3, 2017

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!

@heathkit
Copy link
Contributor

heathkit commented May 3, 2017

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

@woppa684
Copy link

woppa684 commented May 3, 2017

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

@heathkit
Copy link
Contributor

heathkit commented May 3, 2017

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.

@swathivalluri
Copy link

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

@seanmay
Copy link
Contributor

seanmay commented May 5, 2017

@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".

@heathkit
Copy link
Contributor

heathkit commented May 8, 2017

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.

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

No branches or pull requests