首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Selenium-WebDriver UnhandeledPromiseRejectionWarning错误

Selenium-WebDriver UnhandeledPromiseRejectionWarning错误
EN

Stack Overflow用户
提问于 2018-12-15 14:07:40
回答 1查看 110关注 0票数 0

这是我第一次使用Selenium web驱动程序。我有问题‘得到’一个网址。这是我的代码:

代码语言:javascript
复制
const {Builder, By, Key, until} = require('selenium-webdriver'),
  app = require('express'),
  express = app();

let driver = new Builder().forBrowser('chrome').build();

driver.get('https://google.com'); //<---- known bug(doesn't open proper page)

所以,我只是想打开google.com,请告诉我我做错了什么。不管怎么说,当我这么做的时候,节点app.js是错误的:

代码语言:javascript
复制
    DevTools listening on ws://127.0.0.1:12825/devtools/browser/cd5a8eae-4ff0-482e-9f80-cf49f4c3f794
(node:11584) UnhandledPromiseRejectionWarning: WebDriverError: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"A07868DB3EACD45E5235CB0DA6162B30","isDefault":true,"type":"default"},"id":1,"name":"","origin":"://"}
  (Session info: chrome=70.0.3538.110)
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)
    at Object.checkLegacyResponse (C:\Users\Ben Levy\Desktop\bot\node_modules\selenium-webdriver\lib\error.js:585:15)
    at parseHttpResponse (C:\Users\Ben Levy\Desktop\bot\node_modules\selenium-webdriver\lib\http.js:533:13)
    at Executor.execute (C:\Users\Ben Levy\Desktop\bot\node_modules\selenium-webdriver\lib\http.js:468:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:11584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11584) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

,谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-15 14:48:49

从错误中

代码语言:javascript
复制
(Session info: chrome=70.0.3538.110)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)

我可以看到它运行的是旧的chromedriver 2.9,与Chrome不兼容,从这里下载最新版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53793942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档