0

I'm trying to debug a script interactively by command line. If I paste a multiline command the interpreter seems unable to parse the line returns. E.g. trying to paste

page.onConsoleMessage = function(msg) {
  console.log(msg);
};

Fails with:

phantomjs> page.onConsoleMessage = function(msg) {
Expected token '}'

  phantomjs://repl-input:1 in global code
phantomjs>   console.log(msg);
Can't find variable: msg

  phantomjs://repl-input:1 in global code
phantomjs> };
Parser error

  phantomjs://repl-input:1 in global code

Is there any way to make phantom recognise line returns or expect a multiline comment?

geotheory
  • 22,624
  • 29
  • 119
  • 196
  • Seems like this should be supported - http://phantomjs.org/repl.html – geotheory Jul 07 '17 at 08:47
  • Neither of [these](https://stackoverflow.com/a/805113/1156245) appear to work - use of backticks (`Invalid character`), and escaping the literal newline with `\ ` (latter fails with `Unexpected EOF phantomjs://repl-input:1 in global code`). String concatenation with `+` also fails with latter error. – geotheory Jul 07 '17 at 08:54

0 Answers0