Browser capabilities - protractor 2 vs. protractor 3

protractor tool
protractor testing
protractor vs selenium
protractor npm
protractor tutorial
protractor api
protractor github
protractor expectedconditions

i've got an issue regarding my code and different behaviour depending on protractor-version used. My tests are working with protractor version 2.5.1. but to have all benefits from newest development i tried to move to version 3.x.

My onPrepare-function works fine with protractor version 2.5.1:

onPrepare: function () {  //configure junit xml report

    browser.getCapabilities().then(function (capabilities) {
        browser.capabilities = capabilities;
        browser.browserName = capabilities.caps_.browserName;

    var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: true,
        filePrefix: 'frontendtests_result',
        savePath: 'reports'

    var htmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
        new htmlScreenshotReporter({
            dest: 'screenshots',
            pathBuilder: function (currentSpec) {
                return browser.capabilities.get('platform') + '/' + browser.capabilities.get('browserName') + '/v.' + browser.capabilities.get('version') + '/' + currentSpec.fullName.substring(0, 4) + '/' + currentSpec.fullName;
            preserveDirectory: false,
            ignoreSkippedSpecs: true,
            reportOnlyFailedSpecs: true,
            captureOnlyFailedSpecs: false,
            filename: 'my-report.html',
            reportTitle: 'End-to-end-Tests e.VISOR v.4.0 Development Status',
            showSummary: true,
            showQuickLinks: true

With protractor version 3.2.2 i got the following error message:

        C:\Program Files (x86)\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329
          return callbackFn(this.value_);
    TypeError: Cannot read property 'browserName' of undefined
        at D:\SWE\Nitsch\Entwicklung\Hauptprojekt\Entwicklungszweig\Client\EnMS.Angular\EnMS\Frontendtests\protractor.config.js:83:53
        at Promise.invokeCallback_ (C:\Program Files (x86)\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329:14)
        at TaskQueue.execute_ (C:\Program Files (x86)\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2790:14)
        at TaskQueue.executeNext_ (C:\Program Files (x86)\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2773:21)
        at C:\Program Files (x86)\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2652:27
        at C:\Program Files (x86)\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
        at process._tickCallback (node.js:368:9)
    [launcher] Process exited with error code 1

The code line the error is conplaining about is

    browser.browserName = capabilities.caps_.browserName;

What is my mistake here? What is the differnce between protractor 2 and 3 regarding getting browser capabilities.

Any help is welcome ;)

Thanks in advance

Best regards


It changed to capabilities.get('browserName').

Setting Up the Browser - Protractor, This will install two command line tools, protractor and webdriver-manager . Try running The describe and it syntax is from the Jasmine framework. browser is a global created by Protractor, which is used for Because the result is 3, not 5, our test fails. The capabilities object describes the browser to be tested against. In your Protractor conf.js file, we define capabilities object and add information on which browser against Protractor should run the tests. To run tests against the chrome browser we specify capabilities parameter 'browserName' with Chrome, To use other than Chrome, we simply set a different browser name like Firefox.

You can also Update your protractor.conf.js like this

capabilities: {
     'browserName': 'chrome',
     chromeOptions: { args: [ "--headless", "--disable-gpu", "--window-ze=800,600" ] } 

this is for Chrome headless mode

Tutorial - Protractor, @ProtractorTest. Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would. This will install two command line tools, protractor and webdriver-manager . toEqual(3); expect(todoList.get(2​). Additional Features to Handle Multiple Browser Windows In Selenium With Protractor. The Protractor framework is so robust that it provides various customized utilities that allow us to perform

Update your conf.js for Chrome browser:

 capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--headless', '--disable-gpu', '--window-size=800,600']

Protractor, Protractor is a very popular end 2 end testing framework for NodeJS. 3. Protractor is overcomplicated. The next problem of Protractor is the Instead, it delegates a browser control to other libraries, like webdriverio or Protractor. plugins and with that it's possible to extend the capabilities of cypress, one  In my earlier posts here and here, I discussed how to configure protractor for single capabilities and multi-capabilities.In this post I will talk about how to detect the type of browser(s) that the tests are running against (ex. Chrome, Firefox etc.).

5 reasons you should not use Protractor in 2020 - DEV, Protractor is built on top of WebDriver JS (Selenium) and apart from capability setting for your test configuration for eg., browser version, 2. 3. 4. 5. 6. 7. describe('To verify Angular and non Angular application test', () => {. 2. Protractor 6 will break compatibility That's normal on any major release on any framework, because the most open source project use semantic versioning. 3. Protractor is overcomplicated That's not true, is so easy and had many good features, the setup is so easy, the minimum needed is where directory the spec are. Example:

Cross Browser Testing With Protractor & Selenium, A tutorial on how to use Selenium and Protractor to test web applications, with Protractor has built-in capabilities and intelligence to connect with Angular and knows when Step 3: Update WebDriver Manager and Start Up a Server To run a Protractor test for end-to-end automation, you need two files:. Protractor Version: 3.2; browser.getCapabilities() used to return an object with caps_ which was readable, and could be used to examine the browserName and version. Which I can still output the returned capabilities to console, I can't seem to access any of the properties on it anymore, and so our tests won't run in 3.2.

Automated Cross-Browser Testing With Protractor and Selenium , As we know we can run protractor specs on different browsers by In order to run protractor tests on multiple browsers, Protractor offers multiCapabilities configuration It should open two browser instances chrome and firefox and run JavascriptExecutor. (3). Jenkins. (1). JMeter Assertion Examples. (2). 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.