这是我第一次使用Selenium web驱动程序。我有问题‘得到’一个网址。这是我的代码:
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.,谢谢!
发布于 2018-12-15 14:48:49
从错误中
(Session info: chrome=70.0.3538.110)
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64)我可以看到它运行的是旧的chromedriver 2.9,与Chrome不兼容,从这里下载最新版本。
https://stackoverflow.com/questions/53793942
复制相似问题