Selenium-WebDriver UnhandeledPromiseRejectionWarning Ошибка - PullRequest
0 голосов
/ 15 декабря 2018

Я впервые использую веб-драйвер Selenium.У меня проблемы с получением веб-адреса.Вот мой код:

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:

    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.

Спасибо!

1 Ответ

0 голосов
/ 15 декабря 2018

Из-за ошибки

(Session info: chrome=70.0.3538.110)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)

Я вижу, что он устарел chromedriver 2.9 и не совместим с Chrome, загрузите последнюю версию с здесь .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...