夜班人员开始进程时,夜班人员连接被拒绝

时间:2018-04-05 13:53:43

标签: nightwatch.js

我在jenkins上运行的夜班有问题。我的nightwatch.conf.js已经设置了nightwatch来启动服务器。

Starting selenium server... started - PID:  4385

连接被拒绝了! selenium服务器是否已启动?

{ Error: socket hang up
    at createHangUpError (_http_client.js:253:15)
    at Socket.socketCloseListener (_http_client.js:285:23)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:188:7)
    at TCP._handle.close [as _onclose] (net.js:497:12) code: 'ECONNRESET' }

我的jenkins上安装了x虚拟帧缓冲区。知道会发生什么事吗?

1 个答案:

答案 0 :(得分:0)

请确保您拥有最新的硒服务器和浏览器二进制文件。请查看以下NightwatchJS配置。您可以参考nightwatch boilerplate了解更多信息

const seleniumServer = require('selenium-server');
const chromedriver = require('chromedriver');
const firefoxdriver = require('geckodriver');
const phantomjs = require('phantomjs-prebuilt');
const iedriver = require('iedriver');
require('babel-register')();

const nightwatch_config = {
    selenium: {
        start_process: true,
        server_path: seleniumServer.path,
        log_path: '',
        selenium_host: '127.0.0.1',
        selenium_port: 4444,
        cli_args: {
            'webdriver.chrome.driver': chromedriver.path,
            'webdriver.firefox.profile': '',
            'webdriver.gecko.driver': firefoxdriver.path,
            'webdriver.ie.driver': iedriver.path
        }
    }, test_workers: {
        "enabled": false,
        "workers": "auto"
    },
    test_settings: {
        default: {
            launch_url: 'http://localhost',
            silent: true,
            disable_colors: false,
            screenshots: {
                enabled: true,
                on_failure: true,
                on_error: false,
                path: 'screenshots/'
            },
            desiredCapabilities: {
                browserName: 'chrome',
                javascriptEnabled: true,
                acceptSslCerts: true,
                'phantomjs.binary.path': phantomjs.path
            }
        },

        chrome: {
            desiredCapabilities: {
                browserName: 'chrome',
                javascriptEnabled: true,
                acceptSslCerts: true,
                chromeOptions: {
                    args: [/*"disable-web-security",*/ "start-maximized", "start-fullscreen"]
                }
            }
        },
        ie: {
            desiredCapabilities: {
                browserName: "internet explorer",
                javascriptEnabled: true,
                acceptSslCerts: true,
                trustAllSSLCerficates: true,
                ignoreProtectedModeSettings: true,
                acceptInsecureCerts: true,
                platformName: "WINDOWS",
            }
        },
        safari: {
            desiredCapabilities : {
                browserName : "safari",
                javascriptEnabled : true,
                acceptSslCerts : true
            }
        },
        firefox: {
            desiredCapabilities: {
                browserName: 'firefox',
                javascriptEnabled: true,
                acceptSslCerts: true,
                acceptInsecureCerts: true
            }
        },
        ios: {
            selenium_start_process: false,
            selenium_port: 4723,
            selenium_host: "127.0.0.1",
            silent: true,
            desiredCapabilities: {
                browserName: "Safari",
                platformName: "iOS",
                platformVersion: "10.3",
                deviceName: "iPhone 6s Plus"
            }
        },
        android: {
            launch_url: "http://localhost:4723/wd/hub",
            selenium_port: 4723,
            selenium_host: "localhost",
            silent: true,
            desiredCapabilities: {
                browserName: 'Chrome',
                appiumVersion: '1.6.4',
                platformName: 'android',
                platformVersion: '6.0',
                deviceName: 'Android Emulator',
                avd: 'Samsung_S7_Edge_API_23',
                avdArgs: '-dns-server 8.8.8.8',
            }
        },
        s7: {
            launch_url: "http://localhost:4723/wd/hub",
            selenium_port: 4723,
            selenium_host: "localhost",
            silent: true,
            desiredCapabilities: {
                browserName: 'Chrome',
                appiumVersion: '1.6.4',
                platformName: 'android',
                platformVersion: '7.0',
                deviceName: 'Android',
            }
        },
        phantomjs: {
            desiredCapabilities: {
                browserName: 'phantomjs',
                javascriptEnabled: true,
                acceptSslCerts: true,
                'phantomjs.binary.path': phantomjs.path
            }
        },
        mocha: {
            test_runner: {
                type: 'mocha',
                options: {
                    ui: 'bdd',
                    reporter: 'list'
                }
            }
        }
    }
};

module.exports = nightwatch_config;