protractor-tester
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.
Installation
Get the npm package:
npm install protractor-tester
Or
sudo npm install protractor-tester -g
Download and run the Selenium server
The protractor tester requires a Selenium server running at
http://localhost:4444/wd/hub
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:
./node_modules/protractor/bin/install_selenium_standalone
Run the Selenium server with the script that protractor just created:
./selenium/start
How to run it
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 url
Quit
[?] Enter the URL: angularjs.org
Navigating to http://angularjs.org
[?] What action do you want to perform: (Use arrow keys)
❯ Test selector
Go to url
Quit
[?] Find element by: (Use arrow keys)
css
❯ binding
input
name
className
tagName
id
Go back
[?] Enter selector "protractor.By.binding(<your selector>)": name
Found 11 elements
1 '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)
❯ css
binding
input
name
className
tagName
id
Go back