Protractor and Elementor

February 3, 2017
Protractor and Elementor


Locators and elements are the foundation of any automated test (youdontsay). You spend a good portion of your time hunting down the right elements to interact with for tests. Sometimes, you find the right elements through trial, error, and multiple test runs. Not incredibly efficient, right? Thankfully, there are some great options available that help make test development a little less painful. Elementor is one such option that lets you search for and manipulate elements within a browser. Let’s take a look.

Elementor Explained

Elementor is a Node.js app available on GitHub. This project also includes plugins for Webstorm and Sublime, but for this tutorial we’ll just take a look at the features baked right in for Chrome. Since it’s built for Protractor it requires chromedriver and a running selenium server. Don’t forget to have those installed.

Elementor provides two components. First, it launches a separate Chrome browser with a custom extension built in to test your locators and elements. Second, it provides an additional pane in Chrome’s Developer Tools that helps suggest Protractor locators based on an element on the page you select.

To install simply run npm install elementor -g. Once installed start up the selenium server with webdriver-manager start. Finally, in another terminal session start Elementor with elementor The output should look similar to the following:

[20:35:14] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[20:35:15] I/protractor -
[20:35:15] I/protractor - ------- Element Explorer -------
[20:35:15] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report issues at
[20:35:15] I/protractor -
[20:35:15] I/protractor - Type <tab> to see a list of locator strategies.
[20:35:15] I/protractor - Use the `list` helper function to find elements by strategy:
[20:35:15] I/protractor -   e.g., list(by.binding('')) gets all bindings.
[20:35:15] I/protractor -
Server listening on
Done starting protractor
Starting elementor
Elementor is listening on http://localhost:13000
Getting page at:
Connected. Sending command: browser.get('');
Elementor is ready!

This will cause a new Chrome browser window to pop up with the Elementor extension and navigate to the specified url. Let’s first take a look at what’s available in Developer Tools. In that new browser window, duplicate the tab. Why? According to the project, it’s a limitation of the extension as it won’t work in the same tab that was launched.

Now go to dev tools > Elements and a new Protractor pane will be available with the Styles, Computed, Event Listeners, etc. pane groupings. For your viewing pleasure, below is a gif of the steps.

Protractor and Elementor

If you select one of the elements in the Element pane, you will see a list of available locators under Protractor. For example, inspecting the “Name” text field on the page will generate the following locator options:

by.css('input[placeholder="Enter a name here"]'):"1"

The number beside each locator represents how many times that particular element is used. Now that you have locators to work with, you can use one of them to test right on the page too. Copy one of the locators and go back to your first Chrome tab. Click on the Elementor extension, paste in the locator, and hit “Submit.” Elementor will provide a count of the element that you can manipulate further.

For example, element.all(by.css('input[ng-model="yourName"]')).count() can be updated to element.all(by.css('input[ng-model="yourName"]')).sendKeys(‘Strong Bad’) and the text field will be filled in accordingly.

Protractor and Elementor

That’s all there is to it. Elementor can be a great option for pinpointing locators and elements needed for a test. It makes finding and testing a little easier. Check out the project in GitHub and let us know what other tools you’ve used to help your workflow!

Mooney_Mallory square
Mallory Mooney is a QA Engineer at Modus Create. She has experience in developing automation suites for a broad range of frameworks like Angular, Ext JS, and .Net and is an advocate for open source automation tools. She believes in building the “right” tests for the job - not just an arbitrary number of them. Aside from her work, Mallory loves road trips, photography, breakfast tacos, Texas BBQ, and is a loyal Red Raider. Wreck ‘em Tech.

What We Do

We’ll work closely with your team to instill Lean practices for ideation, strategy, design and delivery — practices that are adaptable to every part of your business.

See what Modus can do for you.


We're Hiring!

Join our awesome team of dedicated engineers.