简体   繁体   中英

protractor can not start webdriver session

Please help!

Hi there

I could not run protractor test, thought chrome is pop up with a blank page

In the error message it says webdriver could not be started

✗ protractor config.js --troubleshoot true
[16:32:54] D/launcher - Running with --troubleshoot
[16:32:54] D/launcher - Protractor version: 5.2.0
[16:32:54] D/launcher - Your base url for tests is http://localhost:9000
(node:977) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[16:32:54] I/launcher - Running 1 instances of WebDriver
[16:32:54] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[16:32:54] E/runner - Unable to start a WebDriver session.
(node:977) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): WebDriverError: Cannot define class using reflection
(node:977) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[16:32:54] E/launcher - Error: WebDriverError: Cannot define class using reflection
    at Object.checkLegacyResponse (/home/lzt/.nvm/versions/node/v8.1.1/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/home/lzt/.nvm/versions/node/v8.1.1/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/home/lzt/.nvm/versions/node/v8.1.1/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
[16:32:54] E/launcher - Process exited with error code 100

Bug report

  • Node Version: 8.1.1
  • Protractor Version: 5.2.0
  • Angular Version: 1
  • Browser(s): chrom
  • Operating System and Version ubuntu
  • Your protractor configuration file

 "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const protractor_1 = require("protractor"); exports.config = { seleniumAddress: 'http://127.0.0.1:4444/wd/hub', SELENIUM_PROMISE_MANAGER: false, baseUrl: 'http://localhost:9000', capabilities: { browserName: 'chrome' }, jasmineNodeOpts: { defaultTimeoutInterval: 25000 }, framework: 'custom', frameworkPath: require.resolve('protractor-cucumber-framework'), specs: [ '../../features/login/login.feature' ], onPrepare: () => { protractor_1.browser.ignoreSynchronization = true; protractor_1.browser.manage().window().setSize(1600, 1000); }, cucumberOpts: { compiler: "ts:ts-node/register", strict: true, format: ['pretty'], require: [ '../../features/**/*.ts' // '../../stepdefinitions/loginPage.ts', // '../../support/*.ts' ] } }; 

Did you update webdriver-manager before test run? Let's try to webdriver-manager update

Did you try to run that on node v6?

https://github.com/angular/protractor#compatibility

  • Try running by removing seleniumAddress: 'http://127.0.0.1:4444/wd/hub', from your code.

  • Install LTS version of nodejs than installing latest version.

You have to run the local protractor installation.

npm install protractor --save-dev

Add this to the package.json:

"scripts": { "update-webdriver": "webdriver-manager update", "protractor": "protractor config.js", },

and run:

npm run update-webdriver npm run protractor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM