当前位置:  开发笔记 > 编程语言 > 正文

更新到Angular 2后,无法在Firefox上通过Protractor运行Selenium

如何解决《更新到Angular2后,无法在Firefox上通过Protractor运行Selenium》经验,为你挑选了1个好方法。

在将Angular JS 1.4.x更新为Angular 2后,Selenium测试无法再通过Firefox上的grunt-protractor-runner运行.加载AngularJS后,会发生以下错误:

D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
  var template = new Error(this.message);
                 ^
UnknownError: Permission denied to access property "toString"
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'NAGWS72', ip: '192.168.210.23', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_79'
Driver info: driver.version: unknown
    at new bot.Error (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
    at D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
    at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
    at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
    at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
    at goog.async.run.processWorkQueue (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)
    at process._tickCallback (node.js:366:9)
From: Task: 
    at [object Object].pollCondition [as _onTimeout] (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2233:16)
    at Timer.listOnTimeout (timers.js:92:15)
From: Task: 
    at [object Object].promise.ControlFlow.goog.defineClass.getSchedule.indent.wait (D:/.../node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2226:17)
    at [object Object].webdriver.WebDriver.wait (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:716:21)
    at [object Object].to.(anonymous function) [as wait] (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\protractor.js:65:25)
    at global.doLogin (D:\...\nisXplorerConfig.js:44:21)
    at exports.config.onPrepare (D:\...\nisXplorerConfig.js:79:9)
    at D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\util.js:54:41
    at Function.promise (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\q\q.js:650:9)
    at Object.exports.runFilenameOrFn_ (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\util.js:44:12)
    at [object Object].Runner.runTestPreparer (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\runner.js:76:17)
    at Object.exports.run (D:\...\node_modules\grunt-protractor-runner\node_modules\protractor\lib\frameworks\jasmine.js:89:17)

ChromeInternet Explorer运行正常.

问题出现在以下组件中:

Firefox版本38和42

grunt-protractor-runner 2.1.0和3.0.0(使用selenium-server-standalone-2.48.2.jar)

量角器2.5.1和3.0.0

以下节点模块正在使用(package.json):

{
  "name": "...",
  "version": "1.0.0",
  "description": "",
  "main": "Gruntfile.js",
  "dependencies": {
    "jasmine-reporters": "^2.0.7",
    "protractor-video-recorder": "^0.1.0"
  },
  "devDependencies": {
    "grunt-protractor-runner": "^3.0.0",
    "jasmine-spec-reporter": "^2.4.0",
    "lodash": "^3.10.1",
    "protractor-console": "^2.0.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Selenium测试中没有代码部分,可以将其本地化以产生错误.该错误仅在加载AngularJS时出现.



1> gogol..:

为了找出问题,我安装了带有量角器的Angular 2 Go样品!并得到了完全相同的错误(在我的第一个评论)后,我改变了browserName: 'chrome'firefox.

因此我在Protractors github页面上创建了一个新问题.

推荐阅读
Chloemw
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有