2017-02-09 49 views
3

我試圖用量角器一些端到端的測試,以前也從來沒有使用過。該項目使用yeoman-gulp-angular生成,並且有一些預定義的測試任務/配置。當我嘗試執行任務時,我看到硒已經啓動,然後在硒關閉之前堆棧跟蹤輸出一些錯誤。配置中是否缺少某些東西?角E2E - 錯誤與硒/量角器配置

量角器配置

'use strict'; 

var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths; 

// An example configuration file. 
exports.config = { 
    // The address of a running selenium server. 
    //seleniumAddress: 'http://localhost:4444/wd/hub', 
    //seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json 

    // Capabilities to be passed to the webdriver instance. 
    capabilities: { 
    'browserName': 'chrome' 
    }, 

    // Spec patterns are relative to the current working directly when 
    // protractor is called. 
    specs: [paths.e2e + '/**/*.js'], 

    // Options to be passed to Jasmine-node. 
    jasmineNodeOpts: { 
    showColors: true, 
    defaultTimeoutInterval: 30000 
    } 
}; 

堆棧跟蹤

Starting selenium standalone server... 
(node:23800) DeprecationWarning: util.puts is deprecated. Use console.log instead. 
Selenium standalone server started at http://[IP]/wd/hub 

    Stacktrace: 
    UnknownError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"23817.1","isDefault":true},"id":1,"name":"","origin":"://"} 
    (Session info: chrome=56.0.2924.87) 
    (Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information) 
... 
    Stacktrace: 
    UnknownError: Error communicating with the remote browser. It may have died. 
... 
Finished in 4.84 seconds 
2 tests, 4 assertions, 4 failures 

Shutting down selenium standalone server. 

編輯

[launcher] Error: UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: 
xpi","e":true,"v":"1.7","st":1486662567000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","e":true,"v":"1.0.5","st":1486662567000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","e":true,"v":"1.0","st":1486662567000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"/Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"51.0.1","st":1486662567000}}} 

更新

我想的事情是固定的,但事實並非如此。運行後webdriver-manager update,然後webdriver-manager status我看到chromedriver version available: 2.27 [last]。當我查看node_modules /量角器/硒時,我看到chromedriver_2.12.zip。在node_modules/protractor/config.json中,我將chromedriver的webdriverVersions從2.12更改爲2.27,這是不可用的。不知道我應該在量角器/config.json中指定哪個版本。

test-mbp:fota-admin-portal test$ gulp protractor:src 
[11:48:17] Starting 'webdriver-update'... 
selenium standalone is up to date. 
Updating chromedriver 
downloading https://chromedriver.storage.googleapis.com/2.27/chromedriver_mac32.zip... 
Error: Got code 404 from https://chromedriver.storage.googleapis.com/2.27/chromedriver_mac32.zip 
chromedriver_2.27.zip downloaded to /Users/test/project/node_modules/protractor/selenium/chromedriver_2.27.zip 

/Users/test/project/node_modules/adm-zip/adm-zip.js:19 
      throw Utils.Errors.INVALID_FILENAME; 
     ^
Invalid filename 

堆棧跟蹤

Stacktrace: 
    UnknownError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"26574.1","isDefault":true},"id":1,"name":"","origin":"://"} 
    (Session info: chrome=56.0.2924.87) 
    (Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information) 

回答

2

chromedriver版本你已經是很老的,也不符合最新的Chrome版本不兼容 - 56你有

退房的Protractor ChangeLog的細節chromedriver最新版本

運行webdriver-manager update以獲得最新的驅動程序和應該解決的問題

您還可以檢查chromium site爲chromedriver VS Chrome瀏覽器的兼容性

最新版本:ChromeDriver 2.27可支持Chrome v54-56此版本 修復一個bug導致ChromeDriver在 SharedWorkers的頁面上失敗。

+0

謝謝!這解決了鉻問題,但現在我看到一個Firefox連接錯誤,我沒有在量角器conf文件中定義的firefox。從我讀過的內容看,這似乎是硒和最新的Firefox的一個問題。問題是爲什麼當我甚至沒有將它傳遞給配置文件時,調用firefox?見上面的編輯。 – neridaj

0

從命令提示符執行以下命令來更新從指令端子鉻驅動程序。

「的webdriver經理UDPATE」

一旦鉻司機已經被更新,你就可以沒有任何問題運行情況。

注 - 使用「webdriver的經理地位」看到司機的版本的詳細信息。

讓我知道如果您有任何問題。