关闭 selenium-webdriver 连接时量角器测试失败
Protractor tests fails when closing selenium-webdriver connection
问题
我正在尝试让 AppVeyor 运行使用量角器和 Selenium-webdriver 进行一些 e2e 测试。
在我的本地机器上一切正常,但在 AppVeyor protractor 上构建和测试时似乎由于在 selenium-webdriver 中未找到方法而以代码 1 退出。我试图获取有关错误消息的一些信息,但我的搜索并没有让我找到任何地方。大部分结果来自 Java.
的后端测试
这是构建日志的片段:
node_modules\.bin\gulp protractor
[08:37:23] Using gulpfile C:\projects\kitos\gulpfile.js
[08:37:23] Starting 'protractor'...
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.240.0.18:63619/wd/hub
..
Finished in 42.225 seconds
2 tests, 2 assertions, 0 failures
C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
UnknownError: Can't obtain updateLastError method for class com.sun.jna.Native
at new bot.Error (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
at Object.bot.response.checkResponse (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
at C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
at [object Object].promise.ControlFlow.runInFrame_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
at [object Object].goog.defineClass.notify (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
at [object Object].promise.Promise.notify_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
at Array.forEach (native)
at [object Object].promise.Promise.notifyAll_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
at goog.async.run.processWorkQueue (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:130:15)
at process._tickCallback (node.js:368:9)
[launcher] Process exited with error code 1
[08:38:13] 'protractor' errored after 50 s
[08:38:13] Error in plugin 'gulp-protractor'
Message:
protractor exited with code 1
selenium 服务器正在运行ning,测试通过但是当服务器即将关闭时出现错误。
设置
在构建开始时,我 运行 npm install
又 运行s node_modules\.bin\webdriver-manager update --standalone
作为安装后脚本。
Protractor 运行 带有 gulp 任务和 gulp-protractor 插件,selenium 独立 jar 是在量角器配置中定义的,如下所示:
exports.config = {
seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',
specs: ['Tests/**/*e2e.spec.js'],
resultJsonOutputFile: 'results-protractor.json',
allScriptsTimeout: 30000
};
完整的构建日志可以在这里看到:https://ci.appveyor.com/project/Crevil/kitos/build/1.0.187
为嘈杂的日志道歉。部署日志在控制台中非常响亮,并且无法在 AppVeyor afaict 上配置。
本地日志信息
如前所述,运行在我的本地计算机上一切正常。这是量角器的日志 运行ning.
C:\Users\BSO\Documents\Git repos\kitos>gulp protractor
[09:54:58] Using gulpfile ~\Documents\Git repos\kitos\gulpfile.js
[09:54:58] Starting 'protractor'...
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.5.153:16772/wd/hub
..
Finished in 5.241 seconds
2 tests, 2 assertions, 0 failures
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
[09:55:08] Finished 'protractor' after 10 s
C:\Users\BSO\Documents\Git repos\kitos>
此问题已通过 java 运行时引擎的以下参数解决
localSeleniumStandaloneOpts: {
args: ['-Djna.nosys=true']
},
...
protractor issue here and the specific solution by Feodor Fitsner 中有更多详细信息。
问题
我正在尝试让 AppVeyor 运行使用量角器和 Selenium-webdriver 进行一些 e2e 测试。
在我的本地机器上一切正常,但在 AppVeyor protractor 上构建和测试时似乎由于在 selenium-webdriver 中未找到方法而以代码 1 退出。我试图获取有关错误消息的一些信息,但我的搜索并没有让我找到任何地方。大部分结果来自 Java.
的后端测试这是构建日志的片段:
node_modules\.bin\gulp protractor
[08:37:23] Using gulpfile C:\projects\kitos\gulpfile.js
[08:37:23] Starting 'protractor'...
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.240.0.18:63619/wd/hub
..
Finished in 42.225 seconds
2 tests, 2 assertions, 0 failures
C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
UnknownError: Can't obtain updateLastError method for class com.sun.jna.Native
at new bot.Error (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
at Object.bot.response.checkResponse (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
at C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
at [object Object].promise.ControlFlow.runInFrame_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
at [object Object].goog.defineClass.notify (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
at [object Object].promise.Promise.notify_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
at Array.forEach (native)
at [object Object].promise.Promise.notifyAll_ (C:/projects/kitos/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
at goog.async.run.processWorkQueue (C:\projects\kitos\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:130:15)
at process._tickCallback (node.js:368:9)
[launcher] Process exited with error code 1
[08:38:13] 'protractor' errored after 50 s
[08:38:13] Error in plugin 'gulp-protractor'
Message:
protractor exited with code 1
selenium 服务器正在运行ning,测试通过但是当服务器即将关闭时出现错误。
设置
在构建开始时,我 运行 npm install
又 运行s node_modules\.bin\webdriver-manager update --standalone
作为安装后脚本。
Protractor 运行 带有 gulp 任务和 gulp-protractor 插件,selenium 独立 jar 是在量角器配置中定义的,如下所示:
exports.config = {
seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',
specs: ['Tests/**/*e2e.spec.js'],
resultJsonOutputFile: 'results-protractor.json',
allScriptsTimeout: 30000
};
完整的构建日志可以在这里看到:https://ci.appveyor.com/project/Crevil/kitos/build/1.0.187 为嘈杂的日志道歉。部署日志在控制台中非常响亮,并且无法在 AppVeyor afaict 上配置。
本地日志信息
如前所述,运行在我的本地计算机上一切正常。这是量角器的日志 运行ning.
C:\Users\BSO\Documents\Git repos\kitos>gulp protractor
[09:54:58] Using gulpfile ~\Documents\Git repos\kitos\gulpfile.js
[09:54:58] Starting 'protractor'...
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.5.153:16772/wd/hub
..
Finished in 5.241 seconds
2 tests, 2 assertions, 0 failures
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
[09:55:08] Finished 'protractor' after 10 s
C:\Users\BSO\Documents\Git repos\kitos>
此问题已通过 java 运行时引擎的以下参数解决
localSeleniumStandaloneOpts: {
args: ['-Djna.nosys=true']
},
...
protractor issue here and the specific solution by Feodor Fitsner 中有更多详细信息。