A tool to quickly test your Protractor selectors from the command line.
When I'm writing Protractor integration tests I spend most of my time finding the right selectors. I don't want to run the integration tests just to test a single selector.
The protractor tester allows you to open a Chrome browser and test your selectors from the command line.
Get the npm package:
npm install protractor-tester
sudo npm install protractor-tester -g
The protractor tester requires a Selenium server running at
If you need to install and run Selenium just follow these steps:
Get Protractor, it comes with some helper scripts to download and run the Selenium standalone server.
npm install protractor
Download the Selenium server and the chrome driver:
Run the Selenium server with the script that protractor just created:
First, make sure you have a Selenium standalone server running on port 4444.
If you get the following error your are not running Selenium:
Unhandled error: Error: ECONNREFUSED connect ECONNREFUSED
The protractor tester will open a chrome browser. Now, from the command line you can test a selector, Go to a URL, or quit:
$ protractor-tester[?] What action do you want to perform: (Use arrow keys)Test selector❯ Go to urlQuit[?] Enter the URL: angularjs.orgNavigating to[?] What action do you want to perform: (Use arrow keys)❯ Test selectorGo to urlQuit[?] Find element by: (Use arrow keys)css❯ bindinginputnameclassNametagNameidGo back[?] Enter selector "protractor.By.binding(<your selector>)": nameFound 11 elements1 'AngularJS'2 'Backbone'3 'Batman'4 'Cappucino'5 'Ember'6 'GWT'7 'jQuery'8 'Knockout'9 'Sammy'10 'Spine'11 'SproutCore'[?] Find element by: (Use arrow keys)❯ cssbindinginputnameclassNametagNameidGo back