首页 > 解决方案 > 如何在角度电话猫中运行量角器测试?

问题描述

我尝试执行 e2e 测试并得到一个错误:

Failed: unknown error: call function result missing 'value'
  (Session info: chrome=68.0.3440.106)
  (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.15.0-32-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'egor-home', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-32-generic', java.version: '10.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac), userDataDir=/tmp/.org.chromium.Chromium.hBVoSN}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=68.0.3440.106, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 267829a52edfd44d3eedf3d8c565e1da

Github问题说错误“失败:未知错误:调用函数结果缺少'值'”可以通过chromedriver更新解决。但是错误消息中chromedriver版本为2.26.436382的问题,而node_modules中的版本:

node_modules/chromedriver/bin$ ./chromedriver --version
ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706)

我是对的,问题的根源是使用了错误版本的 chromedriver 吗?如何强制量角器使用最新版本?

标签: angularjsprotractor

解决方案


It looks like the angular-phonecat git checkout gets an old version of protractor and its inner webdriver_manager (which contains the chromedriver being used), causing your error. Running an update on the webdrive_manager, chromedriver or protractor doesn't seem to grab the latest versions as their versions are managed by the ...\angular-phonecat\package.json file. Edit the versions of the packages in this file and run npm install. This should remove the old versions and pull the new versions for you.

I was also running an older version of Chrome and had to update this separately as each chromedriver has a corresponding browser version that it is compatible with.

You can view the versions of the packages with npm v <package> version.

My protractor E2E tests passed with package versions of: protractor 5.4.0, chromedriver 2.41, webdriver-manager 12.1.0, alongside Chrome browser 69.0.3497.81


推荐阅读