Error unknown error: missing or invalid 'entry.level' while executing Nigthwatch.js

Error unknown error: missing or invalid 'entry.level' while executing Nigthwatch.js

您好,我正在尝试 运行 对我的 stagin 环境进行基本测试。相同的通用测试适用于 google 但不适用于我的暂存环境。这是测试:

browser.url('https://google.com')
.execute(function () {

    alert('this works');

});

当我 运行 在我的个人环境中进行此测试时,出现此错误:

Running:  Test Project Play
INFO Request: POST /wd/hub/session 
 - data:  {"desiredCapabilities":{"browserName":"chrome","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","chromeOptions":{"args":["ignore-certificate-errors","disable-web-security","ignore-certificate-errors"]},"name":"Test Project Play"}} 
 - headers:  {"Content-Type":"application/json; charset=utf-8","Content-Length":245}
INFO Response 200 POST /wd/hub/session (1592ms) { status: 0,
  sessionId: '104d0fe3600f4da9b8deddf0adc06b42',
  value: 
   { applicationCacheEnabled: false,
     rotatable: false,
     mobileEmulationEnabled: false,
     networkConnectionEnabled: false,
     chrome: 
      { chromedriverVersion: '2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5)',
        userDataDir: '/tmp/.org.chromium.Chromium.UszN4c' },
     takesHeapSnapshot: true,
     pageLoadStrategy: 'normal',
     databaseEnabled: false,
     handlesAlerts: true,
     hasTouchScreen: false,
     version: '64.0.3282.186',
     platform: 'Linux',
     browserConnectionEnabled: false,
     nativeEvents: true,
     acceptSslCerts: true,
     locationContextEnabled: true,
     webStorageEnabled: true,
     browserName: 'chrome',
     takesScreenshot: true,
     javascriptEnabled: true,
     cssSelectorsEnabled: true,
     unexpectedAlertBehaviour: '',
     'webdriver.remote.sessionid': '104d0fe3600f4da9b8deddf0adc06b42' } }
INFO Got sessionId from selenium 104d0fe3600f4da9b8deddf0adc06b42
INFO Request: POST /wd/hub/session/104d0fe3600f4da9b8deddf0adc06b42/url 
 - data:  {"url":"https://app.bespotful.com/player/6940"} 
 - headers:  {"Content-Type":"application/json; charset=utf-8","Content-Length":47}
INFO Response 200 POST /wd/hub/session/104d0fe3600f4da9b8deddf0adc06b42/url (3064ms) { sessionId: '104d0fe3600f4da9b8deddf0adc06b42',
  status: 13,
  value: { message: 'unknown error: cannot determine loading status\nfrom unknown error: missing or invalid \'entry.level\'\n  (Session info: chrome=64.0.3282.186)\n  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.13.0-36-generic x86_64)' } }
LOG     → Completed command url (3068 ms)
INFO Request: POST /wd/hub/session/104d0fe3600f4da9b8deddf0adc06b42/execute 
 - data:  {"script":"var passedArgs = Array.prototype.slice.call(arguments,0); return function () {\n\n            alert('this works');\n\n        }.apply(window, passedArgs);","args":[]} 
 - headers:  {"Content-Type":"application/json; charset=utf-8","Content-Length":177}
ERROR Response 500 POST /wd/hub/session/104d0fe3600f4da9b8deddf0adc06b42/execute (296ms) { value: 
   { message: 'java.net.ConnectException: Connection refused (Connection refused)',
     error: 'unknown error' },
  status: 13 }
LOG     → Completed command execute (298 ms)
INFO FINISHED
No assertions ran.

我怀疑是 cors 或 ssl 问题,但无法确认。

感谢任何线索。如果我找到答案,我会 post 在这里。

错误说明了一切:

INFO Response 200 POST /wd/hub/session/104d0fe3600f4da9b8deddf0adc06b42/url (3064ms) { sessionId: '104d0fe3600f4da9b8deddf0adc06b42',
  status: 13,
  value: { message: 'unknown error: cannot determine loading status\nfrom unknown error: missing or invalid \'entry.level\'\n  (Session info: chrome=64.0.3282.186)\n  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.13.0-36-generic x86_64)' } }

从您的错误堆栈跟踪可以清楚地看出,Chrome 浏览器会话 没有被初始化。

您的主要问题是您使用的二进制文件之间的版本兼容性,如下所示:

  • 您正在使用 chromedriver=2.29
  • chromedriver=2.29 的发行说明清楚地提到了以下内容:

Supports Chrome v56-58

  • 您正在使用 chrome=64.0
  • chromedriver=2.35 的发行说明清楚地提到了以下内容:

Supports Chrome v62-64

因此 Chrome驱动程序 v2.29Chrome 浏览器 v64.0

解决方案

  • Chrome驱动程序升级到最近的水平chromedriver=2.36
  • 升级Chrome浏览器到最近的水平chrome=65.x.
  • 清理你的项目工作区通过你的IDE重建你的项目只需要依赖。
  • 使用 CCleaner 工具清除执行 测试套件 .
  • 前后的所有 OS 琐事
  • 如果你的基本Chrome浏览器版本太旧,那么通过Revo Uninstaller卸载它并安装最新的GA和发布版本Chrome浏览器.
  • 执行你的@Test.