0
votes

enter image description here

So whenever I run my conf.js file the WebDriver instance start but then it timeouts :(. (See image attached)

Chrome not reachable is the result.

My environment is setting this way:

  • CHROMEDRIVER 2.26

  • selenium-server-standalone-2.53.1

  • [email protected]

  • CHROME BROWSER INSTALLED 55

  • Protractor 5.0.0

This is my conf.js file

exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub/',
specs: ['./reporting/example.js'],
capabilities: { 
    'browserName': 'chrome', 
    chromeOnly:true ,
    directConnect: true,
    'chromeOptions': {'args': ['show-fps-counter=true']}
},

onPrepare: function(){
    browser.driver.manage().window().setPosition(0.0);
    browser.driver.manage().window().setSize(1280.720);
}

}

2
Add jasmine timeouts in your config file jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 100000, isVerbose: true } - Barney

2 Answers

1
votes

Try it with a more simple protractor conf:

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub/',
    specs: ['./reporting/example.js'],
    capabilities: { 'browserName': 'chrome' },
    onPrepare: function() {
        browser.driver.manage().window().setPosition(0.0);
        browser.driver.manage().window().setSize(1280.720);
    }
}

You had directConnect: true in your original conf in the wrong place, which could cause problems. That option means protractor bypasses the selenium server, and connects directly to Chrome. If you wish to do that, use this conf file:

exports.config = {
    directConnect: true,
    specs: ['./reporting/example.js'],
    capabilities: { 'browserName': 'chrome' },
    onPrepare: function() {
        browser.driver.manage().window().setPosition(0.0);
        browser.driver.manage().window().setSize(1280.720);
    }
}
0
votes

Yes agreed directConnect: true in your conf file is in wrong place. it should not include within capabilities tag. it should be placed like below file.

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var log4js = require('log4js');


exports.config = {

 //seleniumAddress: 'http://localhost:4444/wd/hub',
  directConnect: true,
  allScriptsTimeout: 11000,
  framework: 'jasmine2',

  onPrepare: function () {

    browser.manage().timeouts().implicitlyWait(11000);
    var width = 768;
    var height = 1366;
    browser.driver.manage().window().setSize(768, 1366);
    //browser.ignoreSynchronization = true

    jasmine.getEnv().addReporter(
      new Jasmine2HtmlReporter({
        savePath: __dirname+'/reports/results/e2e',
        takeScreenshots: false,
        filePrefix: 'report',
        consolidate: true,
        cleanDestination: false,
        consolidateAll: true

      })
    );
  },

  suites:{
    smoke:['./test/e2e/Login/**/*Spec.js']
  },

  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'args': []//
    }
  },

  appenders: [
    {
      "type": "file",
      "filename": "./e2eTestLogs/logfile.log",
      "maxLogSize": 20480,
      "backups": 3,
      "category": "relative-logger"
    }
  ],

  resultJsonOutputFile:'./results.txt',


  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 510000
  }
};