0
首先,我開始硒:咕嚕Nightwatch與PhantomJS - 「連接被拒絕」
nohup java -jar selenium/selenium-server-standalone-2.47.1.jar -role hub -port 4455&
然後加入PhantomJS驅動程序:在的nohup.out
輸出看起來......成功?:
13:22:52.127 INFO - Launching Selenium Grid hub
2015-12-07 13:22:52.789:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
2015-12-07 13:22:52.833:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
2015-12-07 13:22:52.845:INFO:osjs.AbstractConnector:Started [email protected]:4455
13:22:52.846 INFO - Nodes should register to http://192.168.10.67:4455/grid/register/
13:22:52.846 INFO - Selenium Grid hub is up and running
PhantomJS is launching GhostDriver...
[INFO - 2015-12-07T13:22:56.097Z] GhostDriver - Main - running on port 8080
[INFO - 2015-12-07T13:22:56.097Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4455' using '127.0.0.1:8080'
13:22:56.177 INFO - Registered a node http://127.0.0.1:8080
[INFO - 2015-12-07T13:22:56.184Z] HUB Register - register - Registered with grid hub: http://127.0.0.1:4455/ (ok)
版本的package.json包括:
"devDependencies": {
"grunt": "^0.4.5",
"grunt-nightwatch": "^0.4.8",
"phantomjs": "^1.9.19"
},
的Nightwatch我咕嚕任務的配置是這樣的:
module.exports = {
options: { // default
standalone: false,
globals_path: 'test/globals.js',
custom_commands_path: 'test/commands',
custom_assertions_path: 'test/asserts',
page_objects_path: 'test/pages',
src_folders: ['test/specs'],
output_folder: 'test/report',
test_settings: {
"default": {
"desiredCapabilities": {
"browserName": "firefox"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome"
}
},
"phantomjs": {
"desiredCapabilities": {
"browserName": "phantomjs",
"javascriptEnabled": true,
"acceptSslCerts": true,
"phantomjs.binary.path": "node_modules/phantomjs/bin"
}
}
},
selenium: {
"start_process": false
}
}
};
在這一點上我可以:
grunt nightwatch:phantomjs
這給了我:
連接被拒絕!硒服務器是否啓動?
怎麼了?我如何調試它?是否這樣做說節點應註冊到192.168.10.67(我的機器的本地網絡IP),但GhostDriver註冊到127.0.0.1?
感謝您的答覆 - 我很困惑是:如果我的線以上: 'nohup的Java的罐子硒/硒的服務器獨立-2.47.1.jar -role樞紐-port 4455&' 開始硒,什麼是「start_process」在做什麼? – Wintermute
該命令只能執行一次才能向selenium服務器註冊phantomjs。看着你的日誌,似乎註冊成功了,所以不需要再次運行這個命令。你現在唯一需要做的就是運行'grunt nightwatch:phantomjs',它應該運行測試。設置'「start_process」:TRUE'將確保運行測試時,硒服務器將自動啓動。 –
@Wintermute您是否設法讓它工作? –