0

When I run my specs using protractor to login application, I always get error message "WebDriverError", no more detail information in the log

message="Failed: WebDriverError"
at stack (c:\Users\01.ISSA\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2338:17)
at buildExpectationResult (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2308:14)
at Spec.expectationResultFactory (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:858:18)
at Spec.addExpectationResult (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:487:34)
at Env.fail (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1286:25)
at Function.next.fail (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:4272:19)
at c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\jasminewd2\index.js:64:48
at ControlFlow.emit (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\selenium-webdriver\lib\events.js:62:21)
at ControlFlow.shutdown_ (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\selenium-webdriver\lib\promise.js:2674:10)
at shutdownTask_.MicroTask (c:\Users\Automated_test\CogSol-Test-Automation\e2eProtractorTest\node_modules\selenium-webdriver\lib\promise.js:2599:53)]]

Debugged code, found the code line of causing the error:

var url = browser.params.login.Url;
browser.get(url);

Conf.js:

var path = require('path');
var jasmineReporters = require('jasmine-reporters');
exports.config = {
    directConnect: true,

capabilities: {
   'browserName': 'firefox'
   },

 // Framework to use. Jasmine is recommended.
framework: 'jasmine2',

allScriptsTimeout: 100000,

suites: {
         mytest: ['./cognitivePO/LoginPage.js','./cognitivePO  /deleteOpportunity.js'],
  },

 plugins: [{
        package: 'jasmine2-protractor-utils',
        disableHTMLReport: false,
        disableScreenshot: true,
        screenshotPath:'./reports/screenshots',
        screenshotOnExpectFailure:true,
        screenshotOnSpecFailure:false,
        clearFoldersBeforeTest: true,
        htmlReportDir: './reports/htmlReports',

      }],

// Options to be passed to Jasmine.
jasmineNodeOpts: {
    defaultTimeoutInterval: 500000
 },

onPrepare: function () {  

  jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
              savePath: 'testreports',
              consolidate: true,
              useDotNotation: true
          })); 

  return global.browser.getProcessedConfig().then(function (config) {

  });
}, 


    params: {
          login: {
          Url:'https://w3-nonprod-platform-xxxx-xxxx.xxxxxxx.xxx.com'

        }
        },
};

Package.json:

{
  "name": "cogSol-e2e-test",
  "version": "1.0.0",
  "description": "",
  "main": "SanityConf.js",
  "dependencies": {
    "extend": "^3.0.0",
    "jasmine-reporters": "^2.2.1",
    "jasmine2-protractor-utils": "^1.3.0",
    "path": "^0.12.7",
    "protractor": "<5.4.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "license": "license.txt"
}

I noticed the similar question asked (Protractor - Error: Failed: WebDriverError) but the solution does not apply to my case, so I'm asking again.

Chinaren
  • 5
  • 3
  • I would add more logging in your onPrepare step, and in your beforeAll / beforeEach / it blocks. What part does it actually fail? All I can tell is that it fails in the control flow. You could get off the control flow with SELENIUM_PROMISE_MANAGER: false in your configuration file. I would also suggest doing that since the error message will probably be better. – cnishina Aug 13 '19 at 05:59
  • Per your suggestion, I added SELENIUM_PROMISE_MANAGER: false in my configuration file, then I got error : UnhandledPromiseRejectionWarning: WebDriverError at Object.throwDecodedError (c:\Users\Automated_test\node_modules\selenium-webdriver\lib\error.js:514:15) at parseHttpResponse (c:\Users\Automated_test\node_modules\selenium-webdriver\lib\http.js:519:13) at doSend.then.response (c:\Users\Automated_test\node_modules\selenium-webdriver\lib\http.js:441:30) at process._tickCallback (internal/process/next_tick.js:68:7) – Chinaren Aug 13 '19 at 06:57
  • There are examples that I've previously answered on async / await and SELENIUM_PROMISE_MANAGER. This is the updated example for async / await. https://github.com/angular/protractor/tree/master/example This is not exactly the same since SELENIUM_PROMISE_MANAGER is not required in the next version of Protractor. The rest should be the same. – cnishina Aug 13 '19 at 15:58
  • I tried async / await in my code : loginPage.prototype.open = async () => { await browser.driver.manage().window().maximize(); var url = browser.params.login.Url; await browser.driver.get(url); await browser.sleep(2000); }; I got the same error as above: UnhandledPromiseRejectionWarning: WebDriverError ... – Chinaren Aug 14 '19 at 06:00
  • The problem has never been solved..... – Chinaren Nov 07 '19 at 02:46

0 Answers0