量角器无法使用 Firefox 开始测试 [英] Protractor failed to start test with firefox

查看:27
本文介绍了量角器无法使用 Firefox 开始测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 firefox 56.0.1 版上使用量角器开始测试.我的量角器版本是 5.1.2

I can not start the test with protractor on firefox version 56.0.1. my protractor version is 5.1.2

exports.config = {
    allScriptsTimeout: 11000,
    specs: [
        './e2e/**/*.e2e-spec.ts'
    ],
    capabilities: {
        'browserName': 'firefox'
    },

    directConnect: true,
    baseUrl: 'http://localhost:4444/',
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000,
        print: function() {}
    },
};

这是错误:

[00:02:20] I/launcher - Running 1 instances of WebDriver
[00:02:20] I/direct - Using FirefoxDriver directly...
[00:02:27] E/launcher - Unable to parse new session response: {"value": {"sessionId":"e9d08604-1d7e-4870-85d7-4e09a2248ffa","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"56.0.1","moz:accessibilityChecks":false,"moz:headless":false,"moz:processID":5804,"moz:profile":"C:\Users\s\AppData\Local\Temp\rust_mozprofile.sWpsKwszgKSw","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"6.1","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}
[00:02:27] E/launcher - WebDriverError: Unable to parse new session response: {"value": {"sessionId":"e9d08604-1d7e-4870-85d7-4e09a2248ffa","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"56.0.1","moz:accessibilityChecks":false,"moz:headless":false,"moz:processID":5804,"moz:profile":"C:\Users\s\AppData\Local\Temp\rust_mozprofile.sWpsKwszgKSw","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"6.1","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}
    at WebDriverError (C:UserssWebstormProjectsCo
ode_modulesselenium-webdriverliberror.js:27:5)
    at doSend.then.response (C:UserssWebstormProjectsCommon_IDE
ode_modulesselenium-webdriverlibhttp.js:445:19)
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
    at Function.createSession (C:UserssWebstormProjectsCo
ode_modulesselenium-webdriverlibwebdriver.js:777:24)
    at Function.createSession (C:UserssWebstormProjectsCo
ode_modulesselenium-webdriverfirefoxindex.js:640:55)
    at Direct.getNewDriver (C:UserssWebstormProjectsCo
ode_modulesprotractorlibdriverProvidersdirect.ts:112:25)
    at Runner.createBrowser (C:UserssWebstormProjectsCo
ode_modulesprotractorlib
unner.ts:225:39)
    at q.then.then (C:UserssWebstormProjectsCo
ode_modulesprotractorlib
unner.ts:391:27)
    at _fulfilled (C:UserssWebstormProjectsCo
ode_modulesprotractor
ode_modulesqq.js:834:54)
    at self.promiseDispatch.done (C:UserssWebstormProjectsCo
ode_modulesprotractor
ode_modulesqq.js:863:30)
    at Promise.promise.promiseDispatch (C:UserssaeedWebstormProjectsCo
ode_modulesprotractor
ode_modulesqq.js:796:13)
    at C:UserssWebstormProjectsCo
ode_modulesprotractor
ode_modulesqq.js:556:49
    at runSingle (C:UserssWebstormProjectsCo
ode_modulesprotractor
ode_modulesqq.js:137:13)
[00:02:27] E/launcher - Process exited with error code 199

你知道如何解决这个问题吗?(它可以正常使用 chrome,但使用 Firefox 显示空白页面)

do you have any idea how to solve this problem . (it it work normally with chrome but shows empty page with firefox)

推荐答案

使用 geckodriver,您需要将 Marionette 添加到功能中:

With geckodriver, you'll need to add marionette to the capabilities:

capabilities: {
    'browserName': 'firefox',
    'marionnette': true
},

更新:Protractor 5.1.1 中引入了 未决问题 #4253.解决方法是手动将 directConnect 替换为 seleniumAddress 并按照 bug 中的指定手动启动 webdriver-manager:

UPDATE: There is a open issue #4253 introduced in Protractor 5.1.1 . The workaround is to manually replace directConnect with seleniumAddress and manually start webdriver-manager as specified in the bug:

解决方案是在使用 Firefox 进行测试时单独使用 selenium.最新版selenium独立服务器兼容使用 Protractor 的 selenium JS 绑定和 geckodriver.你可以使用

The solution is to use selenium standalone when testing with Firefox. The latest version of the selenium standalone server is compatible with Protractor's selenium JS bindings and with geckodriver. You can update and launch the standalone server with

webdriver-manager update 
webdriver-manager start 

并设置 seleniumAddress: http://localhost:4444

这篇关于量角器无法使用 Firefox 开始测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆