2017-10-14 122 views
0

我無法使用量角器在Firefox版本56.0.1上開始測試。 我量角器版本是5.1.2量角器無法使用firefox開始測試

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:\Users\s\WebstormProjects\Co\node_modules\selenium-webdriver\lib\error.js:27:5) 
    at doSend.then.response (C:\Users\s\WebstormProjects\Common_IDE\node_modules\selenium-webdriver\lib\http.js:445:19) 
    at process._tickCallback (internal/process/next_tick.js:109:7) 
From: Task: WebDriver.createSession() 
    at Function.createSession (C:\Users\s\WebstormProjects\Co\node_modules\selenium-webdriver\lib\webdriver.js:777:24) 
    at Function.createSession (C:\Users\s\WebstormProjects\Co\node_modules\selenium-webdriver\firefox\index.js:640:55) 
    at Direct.getNewDriver (C:\Users\s\WebstormProjects\Co\node_modules\protractor\lib\driverProviders\direct.ts:112:25) 
    at Runner.createBrowser (C:\Users\s\WebstormProjects\Co\node_modules\protractor\lib\runner.ts:225:39) 
    at q.then.then (C:\Users\s\WebstormProjects\Co\node_modules\protractor\lib\runner.ts:391:27) 
    at _fulfilled (C:\Users\s\WebstormProjects\Co\node_modules\protractor\node_modules\q\q.js:834:54) 
    at self.promiseDispatch.done (C:\Users\s\WebstormProjects\Co\node_modules\protractor\node_modules\q\q.js:863:30) 
    at Promise.promise.promiseDispatch (C:\Users\saeed\WebstormProjects\Co\node_modules\protractor\node_modules\q\q.js:796:13) 
    at C:\Users\s\WebstormProjects\Co\node_modules\protractor\node_modules\q\q.js:556:49 
    at runSingle (C:\Users\s\WebstormProjects\Co\node_modules\protractor\node_modules\q\q.js:137:13) 
[00:02:27] E/launcher - Process exited with error code 199 

你有任何想法如何解決這個問題。 (它是與鉻正常工作,但顯示了Firefox的空頁)

+0

您是否嘗試按錯誤消息所述運行'webdriver-manager'命令? – HaC

+0

是的,我已經運行webdriver-manager更新,但仍然有這個錯誤:E/launcher-無法解析新的會話響應:{...}/WebDriverError:無法解析新的會話響應:{...} – Jan

回答

0

隨着geckodriver,你需要牽線木偶添加到功能:

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

更新:有一個在量角器5.1引入了open issue #4253。 1。解決方法是用seleniumAddress手動更換directConnect和手動啓動webdriver-manager中的bug規定:

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 

and set seleniumAddress: http://localhost:4444

+0

我有添加木偶,但仍然是相同的錯誤 – Jan

+0

對不起。量角器5.1.1中引入了一個錯誤,我誤以爲是錯誤的。我已使用解決方法編輯了我的答案。 – HaC

0

如果你選擇了的DirectConnect那麼你不需要指定基本URL,不需要顯式啓動webdriver服務器

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

    directConnect: true, 
    framework: 'jasmine', 
    jasmineNodeOpts: { 
     showColors: true, 
     defaultTimeoutInterval: 30000, 
     print: function() {} 
    }, 
};