问题
I am learning protractor for e2e testing angularjs and having some difficulties getting things going.
Since I am new to this framework, Im following some tutorials like https://egghead.io/lessons/angularjs-protractor-interactive.
watching the tutorial I see that he checks if an element has been successfully found by *tabbing.
0:56 during the tutorial, after he puts element(by.tagName("button")) and he presumably tabs to see further options available to the button found. he doesn't tell you how he did it actually or if he tabs or not but I am guessing he's tabbing to check if newly found elements gets new available options
I gave tries too.
I made a button and input field as he did and ran into interactive mode.
element(by.tagName("button")).click()
did fine for me. it clicked the button on index.html.
However, I cannot check if the element has been found before clicking it. That means I cannot see click option by tabbing when I am done typing to the point element(by.tagName("button")).
there's more. Trying to gain access to 'click' option on command prompt kills command prompt and makes it unresponsive. I have to force quit command prompt and restart. (The pic I uploaded showing you unresponsive command prompts if you do 'b.c' then tab.)
I found it inefficient to rerun specs just to check if element has been found every time.
I would really appreciate if someone can let me know the right solution to this problems.
Thank you.
回答1:
This was fixed 6 days ago and is not yet released.
So you can wait for Protractor > 1.3.1 or start using master branch.
How to install Protractor from master branch
In case you need sudo
and using Protractor globally installed:
sudo npm -g install git://github.com/angular/protractor#master
I prefer to setup a NodeJS project with package.json and point to an specific Protractor version or commit, for better control:
npm init
npm install --save git://github.com/angular/protractor#ed1c75c7
mkdir -p bin
# some handy shortcuts
ln -s ../node_modules/.bin/protractor bin/p
ln -s ../node_modules/protractor/bin/elementexplorer.js bin/e
# elementexplorer sample usage
bin/e https://angularjs.org/
# Protractor binary sample usage
bin/p your-config.js
来源:https://stackoverflow.com/questions/26206631/e2e-testing-angularjs-with-protractor-protractor-interactive-mode-brakes