|
大神们,想请教一下我用js脚本启动浏览器一直失败,我感觉又不是版本不兼容问题,但是一直没有头绪。有大神给个方向吗?谢谢各位!!
----------------------------脚本代码-----------------------------
const {Builder, By, Key, until} = require('selenium-webdriver');
(async function example() {
let driver = await new Builder().forBrowser('chrome').build();
try {
await driver.get('https://www.baidu.com/');
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
} finally {
await driver.quit();
}
})();
----------------------------错误代码-----------------------------
D:\Documents\Downloads\test>node Untitled-1.js
(node:11576) UnhandledPromiseRejectionWarning: WebDriverError: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
at Object.checkLegacyResponse (D:\Documents\Downloads\test\node_modules\selenium-webdriver\lib\error.js:585:15)
at parseHttpResponse (D:\Documents\Downloads\test\node_modules\selenium-webdriver\lib\http.js:533:13)
at Executor.execute (D:\Documents\Downloads\test\node_modules\selenium-webdriver\lib\http.js:468:26)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:11576) 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:11576) [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. |
|