E / launcher - WebDriverError:远程Chrome的Java堆空间

时间:2016-10-19 12:45:40

标签: protractor selenium-chromedriver

我尝试用istanbul和量角器获得代码覆盖率。如果我运行它本地它可以工作,但当我尝试在远程运行它时,我得到以下错误。如何为WebDriver提供更多堆空间?

根据您的信息,我的规格中只有两个测试。

[13:31:53] I/launcher - Running 1 instances of WebDriver
(node:2792) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

log level set to INFO
Started

.[13:32:21] E/launcher - Java heap space
[13:32:21] E/launcher - WebDriverError: Java heap space
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.executeScript()
at WebDriver.schedule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:377:17)
at WebDriver.executeScript (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:526:16)
at specDone (/opt/jenkins-slave/workspace/tst_coco/test/blumentopf_coco_conf.js:76:46)
at dispatch (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1966:28)
at ReportDispatcher.specDone (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1949:11)
at Spec.specResultCallback [as resultCallback] (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:903:18)
at complete (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:368:12)
at QueueRunner.clearStack (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:660:9)
at QueueRunner.run (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1881:12)
at /usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1898:16
[13:32:21] E/launcher - Process exited with error code 199

1 个答案:

答案 0 :(得分:0)

我通过使用以下注释启动webdriver-manager而不是webdriver-manager启动来解决此问题。通过添加-Xmx1024m,现在有足够的空间,并且作业正在按预期运行。

java -jar -Xmx1024m C:\PApps\Data\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-2.53.1.jar -Dwebdriver.chrome.driver=C:\PApps\Data\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.22.exe -Dwebdriver.ie.driver=C:\PApps\Data\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1.exe -Dwebdriver.edge.driver=C:\Program Files (x86)\Microsoft Web Driver\MicrosoftWebDriver.exe