Connection refused! Is selenium server started nightwatch on edge

感情迁移 提交于 2019-12-31 05:40:10

问题


I have create a project. It is a vue.js application. There is a small set of unit tests (jest) and an end-to-end test (night watch).

When I try and run the end-to-end test using npm i get:

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ value:
   { message: 'Unable to create session from org.openqa.selenium.remote.NewSessionPayload@16b328bc\nBuild info: version: \'3.12.0\', revision: \'7c6e0b3\', time: \'2018-05-08T15:15:08.936Z\'\nSystem info: host:
\'SYNERGY02\', ip: \'192.168.1.41\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_181\'\nDriver info: driver.version: unknown',
     error: 'session not created' },
  status: 33 }

I don't know what I could be missing. This has me stuck for over a week

Here is the nightwatch.json

locate path in D:\xxx\test\bin\myedgedriver.exe

locate path in D:\xxx\test\e2e\nightwatch.conf.js

require('babel-register')
var config = require('../../config')

// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
  src_folders: ['test/e2e/specs'],
  output_folder: 'test/e2e/reports',
  custom_assertions_path: ['test/e2e/custom-assertions'],

  selenium: {
    start_process: true,
    server_path: require('selenium-server').path,
    host: '127.0.0.1',
    port: 4444,
    cli_args: {
      "webdriver.edge.driver": "../bin/MicrosoftWebDriver.exe",
      'webdriver.chrome.driver': require('chromedriver').path,
    }
  },

  test_settings: {
    default: {
      selenium_port: 4444,
      selenium_host: 'localhost',
      silent: true,
      globals: {
        devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
      }
    },

    chrome: {
      desiredCapabilities: {
        browserName: 'chrome',
        javascriptEnabled: true,
        acceptSslCerts: true
      }
    },

    firefox: {
      desiredCapabilities: {
        browserName: 'firefox',
        javascriptEnabled: true,
        acceptSslCerts: true
      }
    },
    edge: {
      desiredCapabilities: {
        browserName: 'edge',
        javascriptEnabled: true,
        acceptSslCerts: true,
        nativeEvents: true
      }
    }
  }
}

and my window ver.

1803 (os build 17134.285)

my edgewebdriver ver.

Release 17134
Version: 6.17134 | Edge version supported: 17.17134 

my edge brower ver.

Microsoft Edge 42.17134.1.0

finally my nightwatch from package.json ver.

 "nightwatch": "^0.9.12"
"selenium-server": "^3.0.1"

回答1:


This error message...

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ value: { message: 'Unable to create session from org.openqa.selenium.remote.NewSessionPayload@16b328bc\nBuild info: version: \'3.12.0\', revision: \'7c6e0b3\', time: \'2018-05-08T15:15:08.936Z\'\nSystem info: host: \'SYNERGY02\', ip: \'192.168.1.41\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_181\'\nDriver info: driver.version: unknown', error: 'session not created' }, status: 33 }

...implies that there was an error connecting to the Selenium Server.

The Selenium Server logs would have given us some more leads to exactly went wrong.

However it seems there is discrepency between your target Test Environment and the existing Test Environment underneath as follows:

  • You have mentioned:

    • my nightwatch from package.json ver: "selenium-server": "^3.0.1"
  • But your error trace log mentions:

    • version: \'3.12.0\' of time: \'2018-05-08T15:15:08.936Z\

Solution

  • Ensure that your Test Environment is configured with a unique set of Selenium Server binaries.
  • Before you start the @Tests ensure Selenium Server is started through the following command:

    java -jar <path_to>/selenium-server-standalone-<version>.jar
    
  • If you want to use native events functionality, indicate this on the command line with the option:

    -Dwebdriver.enable.native.events=1
    
  • To get help on other command line options, execute:

    java -jar <path_to>/selenium-server-standalone-<version>.jar -help
    
  • You can find a similar detailed discussion in:

    • 'Connection refused! Is selenium server started?\n' while running Nightwatch.js tests against Selenium Grid


来源:https://stackoverflow.com/questions/52550626/connection-refused-is-selenium-server-started-nightwatch-on-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!