量角器显示错误的chromedriver版本,无法运行e2e测试

时间:2017-07-13 12:50:28

标签: node.js google-chrome selenium-webdriver protractor selenium-chromedriver

我正在使用angular2 web应用程序,我们已经为e2e测试设置了量角器,但是我的所有测试都因为一些模糊错误而失败。 错误是get

main.py

我的环境是windows 10,节点版本是6.9.1,npm版本是3.8.6,chrome版本是59.xx,chromedriver版本是2.30但是不知道为什么它在控制台中显示2.26以及错误。我试图通过npm install chromedriver(本地和全局)更新它,它显示2.30已安装但是当我尝试运行量角器时它的show chromedriver = 2.26.436362(正如你在输出中看到的那样)。我尝试过很多在互联网上找到的解决方案,但对我来说没有任何效果(包括将chrome升级到最新版本+ chromedriver到最新版本,将chrome降级到58并将chromedriver降级到2.28等)。

我在设置环境时遇到的任何问题?任何帮助,将不胜感激。感谢

******* ******* UPDATE

我已经将chromedriver版本升级到2.30并且现在开始得到不同的错误,它现在甚至没有启动,错误正在跟随

× Full amount can be tendered to card via scanning the device
  - Failed: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
  (Session info: chrome=59.0.3071.115)
  (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10586 x86_64)
  - Failed: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
 (Session info: chrome=59.0.3071.115)
 (Driver info: chromedriver=2.26.436362(5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10586 x86_64)  

1 个答案:

答案 0 :(得分:0)

是的,我见过这个。 Webdriver-manager变得混乱,并抓取错误的版本。要修复,请在 本地(node_modules)和全局(如果你也有)的情况下运行,调整器安装。

  1. bool MakeStringValue(const string& str, v8::Isolate* isolate, v8::Handle<v8::Value>* out_value) { const v8::MaybeLocal<v8::String> maybe_string = v8::String::NewFromUtf8( isolate, str.c_str(), v8::NewStringType::kNormal, str.size()); v8::Handle<v8::String> value; if (!maybe_string.ToLocal(&value)) { return false; } *out_value = static_cast<v8::Handle<v8::Value>>(value); return true; } bool ConvertValueToString(v8::Handle<v8::Value> value, v8::Isolate* isolate, v8::Local<v8::Context> context, string* value_string) { v8::Local<v8::Object> global = context->Global(); v8::Handle<v8::Value> json_string_value; v8::Handle<v8::Value> stringify_string_value; if (!MakeStringValue("JSON", isolate, &json_string_value) || !MakeStringValue("stringify", isolate, &stringify_string_value)) { return false; } const v8::MaybeLocal<v8::Value> maybe_json_value = global->Get(context, json_string_value); v8::Handle<v8::Value> json_value; if (!maybe_json_value.ToLocal(&json_value)) { return false; } v8::MaybeLocal<v8::Object> maybe_json_object = json_value->ToObject(context); v8::Handle<v8::Object> json_object; if (!maybe_json_object.ToLocal(&json_object)) { return false; } const v8::MaybeLocal<v8::Value> maybe_stringify_value = json_object->Get(context, stringify_string_value); v8::Handle<v8::Value> stringify_value; if (!maybe_stringify_value.ToLocal(&stringify_value)) { return false; } v8::Function* stringify_function = v8::Function::Cast(*stringify_value); v8::TryCatch try_catch(isolate); const v8::MaybeLocal<v8::Value> maybe_result = stringify_function->Call(context, json_object, 1, &value); v8::Local<v8::Value> result; if (try_catch.HasCaught() || !maybe_result.ToLocal(&result) || result.IsEmpty() || result->IsNullOrUndefined() || !result->IsString()) { return false; } v8::Local<v8::String> result_string; if (!result->ToString(context).ToLocal(&result_string)) { return false; } v8::String::Utf8Value utf8_value(result_string); // operator* returns a const char*. if (*utf8_value == nullptr) { return false; } value_string->assign(*utf8_value, utf8_value.length()); return true; }
  2. node_modules/.bin/webdriver-manager clean // removes all older versions