Protractor FIVE

So Protractor 5.0.0 was released today. What does it mean? What things should I be aware of? Where do we start? First off, check out the changelog. I’ll try to go into in depth reasons and additional highlights. So let’s run through the breaking changes from the changelog:

  • Use node 6.9.x+. Why? Selenium-webdriver 3.0.1 requires node 6.9.x+. They adopted node 6 to allow for ES6 native promises.
  • We recommend using Firefox 47. In order for this to work, FF needs to be noted with legacy capability: capabilities: { browserName: ‘firefox’, marionette: false }. Why? At the time, we tried selenium standalone server combinations for FF 48+ and selenium standalone server 2.53.1 and 3.0.1. These do not work. There is a solution and it will be available at the next release of Protractor.
  • Jasmine TypeScript users will now need to install @types/jasmine. Why? Mocha users that require @types/mocha will have conflicting types.
  • Selenium-webdriver methods were removed. Why is this important? Protractor has several types that have inherited selenium-webdriver functionality. So for ElementFinder, previously we exported selenium-webdriver’s WebElement.prototype.getInnerHtml. Since it is no longer there, this is no longer available to you. So what’s the list look like: WebDriver.prototype.isElementPresent,WebElement.prototype.getRawId, WebElement.prototype.getInnerHtml, WebElement.prototype.getOuterHtml, and webdriver.error.ErrorCodes.


let isPresent = browser.driver.isElementPresent(By.tagName('a'));
let i = element(locator).getInnerHtml();
let o = element(locator).getOuterHtml();


let isPresent = element(By.tagName('a')).isPresent();
let i = browser.executeScript("return arguments[0].innerHTML;", element(locator));
let o = browser.executeScript("return arguments[0].outerHTML;", element(locator));
  • Adding cookies has changed: Before: browser.manage().addCookie('testcookie', 'Jane-1234'); After: browser.manage().addCookie({name:'testcookie', value: 'Jane-1234'});
  • Removed protractor.wrapDriver(). Why? Before users could create a new browser instance from capabilities and the wrapDriver method. The recommended way is to use browser.forkNewDriverInstance().
  • You can no longer use repl command from within browser.pause(). Instead, use browser.explore() to directly enter the repl.
  • Sending flags that are not recognized by the CLI throws an error. Why? Let’s say you want to run protractor conf.js --baseUrl ‘’ but instead you wrote protractor conf.js --baseurl ‘’. The change here is subtle, and might resolve in false positives. For example, if yourbaseUrl was set to production, the tests might pass and the new website features that were created might be missed. There are other options available that are not part of the list of checks and if you plan to disable this you can send the --disableChecks flag.
  • Auto-detection of the root element. This is a breaking change because it changes the default root element behavior and removes the config.useAllAngular2AppRoots flag. Modern angular apps now default to using all app hooks, and ng1 apps now check several places, notably the element the app bootstraps to.
  • sauceProxy configuration field has been removed. Why? The webDriverProxy was being used instead of the sauceProxy. Before: sauceProxy: 'http://sauceProxy' After: webDriverProxy: 'http://sauceProxy'

To upgrade or to not upgrade

So should you upgrade your tests? Yes! Just make sure you have node 6.9.x+. Actually, I’d flip the version and see what breaks. Why would you not want to upgrade?

I recently answered a StackOverflow question if a user should update from Protractor version 2 to version 4 but they still needed to test on IE 9. When they flipped the version, everything broke. So in this case, the answer is no. Because you are testing against an older browser, it might be better to use the version of Protractor that supports that driver version. You could experiment with an older driver version and a newer version of Protractor but there could always be an API mismatch causing tests to fail.

Like what you read? Give Craig N a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.