Renaud
Renaud

Reputation: 4668

Debugging in protractor

I find myself in a completely different scope using browser.debugger(). I cannot access the other scope variables from my tests, only global variables. Here is the backtrace:

debug> bt
#0 protractor.js:1039:5
#1 webdriver.promise.ControlFlow.runInNewFrame_ promise.js:1598:20
#2 webdriver.promise.ControlFlow.runEventLoop_ promise.js:1463:8
#3 b native v8natives.js:1594:37

Am I supposed to debug using browser and selectors only?

Upvotes: 1

Views: 1900

Answers (2)

Howard Yang
Howard Yang

Reputation: 34

actually, when i debug protractor spec.js, i do use node-inspector,

  1. install node-inspector from command line 'npm install -g node-inspector'
  2. use below command to begin debug 'node-debug node_modules\protractor\bin\protractor test/protractor-conf.js'

then chrome window should open, and pause at the first line of protractor, from sources / file:// part find your *spec.js, add breakpoint in *spec.js, run, chrome should pause at you just setted breakpoint ,do not need to use browser.debugger() or debugger;

Upvotes: 1

Brad8118
Brad8118

Reputation: 4702

We're using the chrome driver with Intellij and we're able to set break points right in the IDE. We add the line broswer.debugger(); and then we put a break point after it.
We had issues getting debugging to work. We got it working on 2.40 I believe. Check the git history to see if anything has changed with the version you're using. Good luck

Upvotes: 0

Related Questions