Enter the characters shown in the image.

You are here

Selenium and Protractor

The benefits on using Protractor for your JavaScript tests instead of using Selenium WebDriver directly, even if your app has nothing to do with AngularJS yet - or just a partial usage.

If you peek inside Protractor you’ll see the good old Selenium Web Driver (aka WebDriverJS aka selenium-webdriver).

Protractor is essentially a wrapper for the JavaScript Selenium WebDriver. Therefore – you get all the capabilities of the WebDriver – along with a number of very useful additions.


They probably added some Angular stuff 

They added accessories to angular models, bindings, ng-options – and finding elements inside ng-repeat. These additions make querying for elements much easier. For example – let’s get all the ages of the cats that the repeater adds:

<div ng-repeat="cat in pets">

// test code:
// ---------
// Returns a promise that resolves to an array of
// WebElements from a column
var ages = element.all(
    by.repeater('cat in pets').column('{{cat.age}}'));

Ever struggled with the challenge of determining when the page is truly ready, i.e. all the asynchronously fetched resources are ready and processed? Check out waitForAngular that does exactly that.


I don’t use Angular yet 

They added other goodies – accessors (locators) by button text, partial button text – and the very cool option to find by a combination of CSS and text (get me all the divs with class ‘pet’ and text 'dog’).

Also – they added the addLocator function to help you add your own locators – so that, for a fictional example, you can get elements by their handlebars properties.


I’m already using Selenium extensively

First of all, pat yourself on the back – you’re already in better shape than most teams out there. You can install Protractor and use it with your existing infrastructure. Simply configure Protractor to operate against your Selenium servers.

Please note: You’ll have to take some additional steps to run Protractor successfully on non-Angular pages. We will cover this issue in the next post.


One more addition that makes life easier for users is globals.

Protractor adds these objects to the global namespace: browser, element and by. Now go ahead and spot the difference between the two canonical examples:

Protractor (9 lines of code, not including the comments):

// starting right here with two Jasmine lines.
// All the rest is preconfigured separately and very easily.
describe('angularjs homepage', function() {
    it('should add one and two', function() {
        // Just go ahead and use the webdriver – the configuration
        // took care of the initialization
        // much shorter than driver.findElement… webdriver.By…
        // please appreciate how naturally
        // expect works with this flow

Selenium (17, longer, lines of code, not including the comments):

// Defining some requirements – to be able to use assertions
// and test syntax
var assert = require('assert'),
    test = require('selenium-webdriver/testing'),
    webdriver = require('selenium-webdriver');

// Now we can write a test
test.describe('Google Search', function() {'should work', function() {
        // We need to setup the webdriver…
        var driver = new webdriver.Builder().

        // finally we can actually do something
        // all the functions are accessed via driver of webdriver.
        // Much typing!
        // spoon-feeding the assertion using then
        // and resolving the value
        driver.getTitle().then(function(title) {
            assert.equal(title, 'webdriver - Google Search');
        // calling this ourselves



Starting to work with Protractor is a breeze. You get the Jasmine test library out of the box – with a bonus patch to the 'expect’ function to easily provide validation through assertion. You get webdriver-manager to take care of the local webdriver server for you and make it easy to test against a remote server. You don’t have to run your tests directly as scripts using node – as your initial attempts with selenium will have you do.

This brings us to another point – Protractor has much better documentation, in my opinion.



Protractor is neat – and I see it as a very useful evolution from Selenium Webdriver for JavaScript.

It’s not limited to testing only AngularJS apps – even though these two are usually mentioned together. However - it was designed mainly for Angular and some work is required, at least currently, to use it on non-angular pages. We will review this in the next post. If you plan to gradually move your site/app to Angular - you can start writing your Protractor E2E tests right now - and I will show you how.

If you’re already using Angular, there’s a bunch of guides out there that will help you get started with Protractor – and I intend to provide more information in future posts.



Web testing

List mode
Table mode
Icons mode

Displaying 1 - 199 of 199


Testing tool manufacturers world-wide list
10Levels ABID CONSULTING AccelQ Accord Software ActiMind AdaCore
AdaLog AgileLoad AgileWay Agitar Algorismi ALL4TEC
Andreas Kleffel Android Apache Apica Apollo Systems
Applitools AppPerfect Appsee ApTest Assertible Assure
Atlassian AutoIt Consulti .. Automation Anyw .. Automation Cons .. Axosoft Aztaz Software
Backtrace I/O Badboy BlazeMeter Borvid BrowserStack BSQUARE
BStriker Intern .. CA Technologies Canonical Canoo Engineeri .. Catch Software CelestialTeapot
Chris Mallett Cleanscape ClicTest CloudQA Codeborne CodeCentrix
CodePlex projec .. Codoid Cogitek Compuware Configure IT Conflair
ConSol Core Services Coronys Ltd Countersoft CresTech Softwa .. CrossBrowserTes ..
Crosscheck Netw .. Crowdsourced Te .. Cucumber Ltd Cyara Cygnet Infotech DareBoost
Databene Datamatics Glob .. DevExpress DTM soft Dynatrace LLC EasyQA
Eclipse EkaTechserv Elvior Emmanuel Jorge Empirix EPAM Systems
Equafy Esterel Technol .. eXept Software .. Experitest Finaris Froglogic
FrontEndART Ltd GeneXus GitHub project gnoso Google Code Pro .. GrammaTech
Gurock Software HelpSystems HENIX Hewlett Packard .. Hexawise High-Tech Bridg ..
Hiptest Hitex IBM Rational imbus Shanghai Impetus Inflectra
informUp InTENSO - IT Ex .. Ipswitch Jamo Solutions Janova JAR Technologie ..
JBoss Developer jClarity JetBrains Jively jQuery foundati ..
JS Foundation Jspresso Kanoah KMS Technology Kualitee LDRA Limited
Litmus LoadFocus Loadster Perfor .. MarathonITE Marketcircle Marketcircle
Maveryx Meliora Ltd Micro Focus Sof .. Microsoft Mobile Labs Mobile1st
Mockaroo, LLC Monkop Mozila MSys Technologi .. Navicat NeoTys
Neowise Softwar .. NetCart NORIZZK.COM Novosync Mobili .. NRG Global NTT Resonant
OC Systems Odin Technology OpCord Oracle Orcanos Original Softwa ..
OW2 PANAYA Parasoft PassMark Patterson Consu .. Perfecto Mobile
Pivotal, Inc. Plutora Postman (API To .. PractiTest PrimaTest Process One
Programming Res .. Psoda PureLoad PushToTest Python Q-Assurance
QA Systems QACube QASymphony QAWorks QMetry Quali
Qualitia Softwa .. Quality First S .. Quotium RadView Softwar .. Ranorex RedLine13
Reflective Solu .. ReQtest RevDeBug Robotium Tech Rogue Wave Soft .. Rommana Softwar ..
RTTS Runscope Sandklef GNU La .. Sauce Labs Seapine Softwar ..
SeleniumHQ Sencha Sensiple Siemens PLM Sof .. SmartBear Softw .. SmarteSoft
SOASTA SoftLogica Softomotive Softsmith Solution-Soft SonarSource
Sourceforge Spirent Technol .. SQS Software Qu .. Square Stimulus Techno .. Swifting AB
Synopsys T-komp T-Plan TechExcel TechTalk Telerik By Prog ..
Tellurium Test Collab Test Goat Test Recon TestCaseLab Gm ..
TestCraft Techn .. Testenium TestingBot TestLodge Testmunk
Testomato TestOptimal TestPlant TestPro Testsigma Techn .. Testuff
The Core Bankin .. The MathWorks The Open Group Thoughtbot Thoughtworks Time Simulator Top-Q Trace Technolog .. TrendIC TRICENTIS
Tritusa Pty Ltd TWD Solutions P .. TypeMock Tyto Software Ubertesters UniTESK
Universal Test .. Usetrace Ltd Utrecht Univers .. Validata Group Vanamco AG Vector Software
Veracode Verifaya Corpor .. Verit VersionOne Vornex Inc. WcfStorm Soluti .. We Are Mammoth Web Performance .. Wintask Wireshark Found ..
Worksoft Xceptance XK72 Xpand IT XQual ZAPTEST
Zeenyx Software .. Zephyr Zeta Software zutubi pty

Selenium Youtube Playlist

Theme by Danetsoft and Danang Probo Sayekti