The Node.js debugger hides most of my string variables, it prints ... instead, like so: (there's a variable named source)
$ node debug 127.0.0.1:9101
debug>
debug> exec('source')
'<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" class="DW dw-pri js no... (length: 6408)'
debug>
debug> repl
Press Ctrl + C to leave debug repl
> source
'<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" class="DW dw-pri js no... (length: 6408)'
As you can see, it replaces most of the string, with .... I've googled for a while and typed help in the console. Finally posting here — how do I view the full contents of the string? console.log(source) didn't do anything.
Edit: Now I noticed that console.log does print the variable, in Selenium's terminal window, which perhaps is what I ought to have expected. Not sure if console.log and switching to the Selenium terminal window, is what I'm supposed to do
Update:
Typing just source doesn't work, outside repl:
debug> source
ReferenceError: source is not defined
at repl:1:1
at ContextifyScript.Script.runInContext (vm.js:32:29)
at Object.runInContext (vm.js:87:6)
at Interface.controlEval (_debugger.js:971:21)
at REPLServer.eval (_debugger.js:745:41)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:96:13)
at REPLServer.emit (events.js:191:7)
(and when inside repl, the variable gets truncated, as shown in the topmost snippet above.)
And print(source) or print('source'):
debug> print('source')
ReferenceError: print is not defined
at repl:1:1
at ContextifyScript.Script.runInContext (vm.js:32:29)
at Object.runInContext (vm.js:87:6)
at Interface.controlEval (_debugger.js:971:21)
at REPLServer.eval (_debugger.js:745:41)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:96:13)
at REPLServer.emit (events.js:191:7)
debug> repl
Press Ctrl + C to leave debug repl
> print(source)
ReferenceError: print is not defined
There aren't many commands to choose among: (in the debugger)
debug> help
Commands: run (r), cont (c), next (n), step (s),
out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, exec, restart, kill, list, scripts,
breakOnException, breakpoints, version
watch("your_var_name") will print the value of the variable(s) you watch at each breakpoint (you must put the variable/expression name in quotes).
This seems to be the closest thing available on the command line, although frankly just writing
console.log(thing I want to log);
debugger;
feels easier to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With