问题
I want to run Nightwatch Test with Firefox in the background using Windows Task Scheduler. I am able to run the test manually. However, I got an error when I run the task using Windows Task Scheduler. The selenium started successfully but there was a problem with the Firefox/Gecko Driver. The test is successful with IE and Chrome.
I have read from this discussion:
andreastt commented on 11 Sep 2017
geckodriver does not support running as Windows service.
How do I fix this? Is there any workaround so that Geckodriver can run in the background? (As Windows service) Or is there any other way to run Nightwatch test in Firefox in the background?
This is my Nightwatch.json file:
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"page_objects_path" : "",
"custom_assertions_path" : "",
"globals_path" : "./global/globals.js",
"live_output" : false,
"parallel_process_delay" : 10,
"disable_colors": false,
"test_workers" : false,
"selenium" : {
"start_process" : true,
"server_path" : "./selenium/selenium391.jar",
"log_path" : "./reports",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./selenium/chromedriver.exe",
"webdriver.ie.driver" : "./selenium/IEDriverServer.exe",
"webdriver.gecko.driver" : "./selenium/geckodriver.exe"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_host" : "127.0.0.1",
"selenium_port" : 4444,
"silent" : true,
"disable_colors": false,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities" : {
"browserName" : "firefox",
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
},
This is the error I got on selenium-debug.log:
12:49:00.828 INFO - Selenium build info: version: '3.9.1', revision: '63f7b50'
12:49:00.828 INFO - Launching a standalone Selenium Server on port 4444
2018-02-19 12:49:00.922:INFO::main: Logging initialized @364ms to org.seleniumhq.jetty9.util.log.StdErrLog
2018-02-19 12:49:01.046:INFO:osjs.Server:main: jetty-9.4.7.v20170914, build timestamp: 2017-11-21T22:27:37+01:00, git hash: 82b8fb23f757335bb3329d540ce37a2a2615f0a8
2018-02-19 12:49:01.093:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@2b9627bc{/,null,STARTING} has uncovered http methods for path: /
2018-02-19 12:49:01.093:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@2b9627bc{/,null,AVAILABLE}
2018-02-19 12:49:01.499:INFO:osjs.AbstractConnector:main: Started ServerConnector@646d64ab{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-02-19 12:49:01.499:INFO:osjs.Server:main: Started @940ms
12:49:01.499 INFO - Selenium Server is up and running on port 4444
2018-02-19 12:49:01.686:INFO:osjshC.ROOT:qtp110456297-15: org.openqa.selenium.remote.server.WebDriverServlet-27efef64: Initialising WebDriverServlet
12:49:01.748 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@65dcd5b7
12:49:01.748 INFO - /session: Executing POST on /session (handler: BeginSession)
12:49:01.826 INFO - Capabilities are: Capabilities {acceptSslCerts: true, browserName: firefox, javascriptEnabled: true, name: Google Wiki}
12:49:01.826 INFO - Capabilities {acceptSslCerts: true, browserName: firefox, javascriptEnabled: true, name: Google Wiki} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
1519040941951 geckodriver INFO geckodriver 0.19.1
1519040941967 geckodriver INFO Listening on 127.0.0.1:8022
1519040943074 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\Username\\AppData\\Local\\Temp\\rust_mozprofile.pHPWQBBUG5ZG"
1519040944766 Marionette INFO Enabled via --marionette
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0058,name=PContent::Msg_SetPluginList) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C004D,name=PContent::Msg_GMPsChanged) Channel error: cannot send/recv
###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150090,name=PBrowser::Msg_UpdateNativeWindowHandle) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150084,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0040,name=PContent::Msg_LoadProcessScript) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150081,name=PBrowser::Msg_LoadRemoteScript) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0040,name=PContent::Msg_LoadProcessScript) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0040,name=PContent::Msg_LoadProcessScript) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C00FE,name=PContent::Msg_AsyncMessage) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150001,name=PBrowser::Msg_AsyncMessage) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150090,name=PBrowser::Msg_UpdateNativeWindowHandle) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150084,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
Unable to read VR Path Registry from C:\Users\Username\AppData\Local\openvr\openvrpaths.vrpath
JavaScript error: resource://shield-recipe-client/lib/ShieldRecipeClient.jsm, line 70: TypeError: log is undefined
###!!! [Parent][MessageChannel] Error: (msgtype=0x150090,name=PBrowser::Msg_UpdateNativeWindowHandle) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150084,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping
来源:https://stackoverflow.com/questions/48867084/running-nightwatch-test-in-firefox-fails-when-using-windows-task-scheduler