1
我正在嘗試使用Nightwatch.js來執行自動化單元和端到端測試。 Nightwatch.js取決於Selenium。在C9.io中安裝/使用Selenium for Nightwatch.js
- 我已經確定瞭如何安裝它(請參閱「步驟來安裝硒」的),並且可以得到Selenium服務器啓動(通過
bin/ java -jar selenium-server-standalone-2.48.2.jar
)。 - 但是,當我嘗試實際運行基本夜間測試時,由於瀏覽器,網址和端口配置問題(以下錯誤),我收到錯誤。
- 有人可以提供一些提示我應該如何configure the nightwatch.json文件與Selenium安裝到C9中的一些提示?
步驟安裝硒
mkdir bin
cd bin
wget "http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.2.jar"
unzip selenium-server-standalone-2.48.2.jar
cd ..
LOG
03:26:27.875 INFO - Executing: [new session: Capabilities [{platform=ANY, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, name=Basic}]])
03:26:27.893 INFO - Creating a new session for Capabilities [{platform=ANY, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, name=Basic}]
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
(process:3585): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: no display specified
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:91)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:68)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
03:27:13.875 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'metasean-learnin-nightwatch-2330511', ip: '172.17.33.167', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-c9', java.version: '1.7.0_85'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:58)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:175)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:202)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:164)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'metasean-learnin-nightwatch-2330511', ip: '172.17.33.167', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-c9', java.version: '1.7.0_85'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:101)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:68)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:91)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows:
(process:3585): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: no display specified
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'metasean-learnin-nightwatch-2330511', ip: '172.17.33.167', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-c9', java.version: '1.7.0_85'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
... 14 more
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
(process:3585): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: no display specified
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
... 19 more
03:27:13.884 WARN - Exception: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
(process:3585): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: no display specified
所以你的問題是夜間或硒? –
@YerkoPalma - 我原來的問題是在C9中運行Selenium,這樣我就可以在C9中使用Nightwatch,我可以讓C9運行Selenium(這是好消息),但不幸的是,我無法讓Nightwatch在C9上運行(這是壞消息)。 – MetaSean