虚拟机上 NodeJS 的量角器 - 如何修复错误 199? [英] Protractor for NodeJS on a virtual machine - How do I fix error 199?
问题描述
我正在尝试在虚拟机上使用量角器,但收到错误代码 199.
I'm trying to use Protractor on a virtual machine and am getting the error code 199.
我按照完全相同的步骤学习本教程 - http://www.protractortest.org/#/教程
I am following this tutorial with the exact same steps - http://www.protractortest.org/#/tutorial
当我在命令行输入 protractor conf.js 时,出现以下错误:
When I enter protractor conf.js on the command line, I get the following error:
[14:51:31] I/hosted - Using the selenium server at (my url here)
[14:51:31] I/launcher - Running 1 instances of WebDriver
[14:51:51] E/launcher - null
[14:51:51] E/launcher - WebDriverError: null
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
at client_.send.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11)
at ManagedPromise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:197:43)
at /usr/local/lib/node_modules/protractor/built/runner.js:276:30
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[14:51:51] E/launcher - Process exited with error code 199
问题不在于连接到 webdriver,因为我已经公开了一个端口并且能够访问 url 并查看它的集线器.
The problem is not connecting to the webdriver as I have exposed a port and able to access the url and view the hub for it.
谢谢.
推荐答案
经过大量的刺激、运行 strace
、手动运行等,我设法在 debian/devuan 上找到了这个问题的底部.如果我手动运行 chromium
它工作正常(Chrome 会出现,我可以浏览).但是,每次我运行 protractor
时,都会出现长时间挂起,然后是:
After a lot of prodding, running strace
, running manually etc I managed to get to the bottom of this on debian/devuan. If I ran chromium
by hand it worked fine (Chrome would appear and I could browse). However every time I ran protractor
there would a long hang followed by:
E/launcher - null
E/launcher - WebDriverError: null
protractor
的
strace
显示 selenium
返回 500 系列错误.查看 ps uwww
让我看到正在执行以下命令:
strace
of protractor
was showing selenium
was returning a 500 series error. Looking at ps uwww
allowed me to see that the following command was being executed:
java -Dwebdriver.chrome.driver=.../webdriver-manager/selenium/chromedriver_2.26
-jar .../selenium-server-standalone-2.53.1.jar -port 60987
手动运行,连接到实例,创建新会话并选择 chrome 出现错误:
Running this manually, connecting to the instance, creating a new session and selecting chrome gave the error:
.../webdriver-manager/selenium/chromedriver_2.26: error while loading shared libraries:
libgconf-2.so.4: cannot open shared object file: No such file or directory
使用 apt-get install libgconf-2-4
安装 libgconf2
(在 Devuan Jessie 上),然后修复了手动创建的 selenium
实例和 protractor
测试.
On installing libgconf2
with apt-get install libgconf-2-4
(on Devuan Jessie) this then fixed both the manually created selenium
instance and the protractor
test.
这篇关于虚拟机上 NodeJS 的量角器 - 如何修复错误 199?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!