UnhandledPromiseRejectionWarning: NoSuchSessionError
UnhandledPromiseRejectionWarning: NoSuchSessionError
App.js
const webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('chrome').build();
driver.get('www.google.com');
driver.sleep(10000);
driver.quit();
When I try to run my app.js the following error appears:
$ node app.js
DevTools listening on
ws://127.0.0.1:12525/devtools/browser/8885c592-ea61-41cd-ade7-222a355ea668
(node:14556) UnhandledPromiseRejectionWarning: NoSuchSessionError: no
such session (Driver info: chromedriver=2.9.248315,platform=Windows
NT 6.3 x86_64)
at Object.checkLegacyResponse (C:UsersAseelDesktopelcccnode_modulesselenium-webdriverlib
error.js:585:15)
at parseHttpResponse (C:UsersAseelDesktopelcccnode_modulesselenium-webdriverlibhttp.js:5
33:13)
at Executor.execute (C:UsersAseelDesktopelcccnode_modulesselenium-webdriverlibhttp.js:46
8:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7) (node:14556) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated ei ther by throwing inside of an
async function without a catch block, or by rejecting a promise which
was not handled with .catch(). (rejection id: 2) (node:14556)
[DEP0018] DeprecationWarning: Unhandled promise rejections are
deprecated. In the futur e, promise rejections that are not handled
will terminate the Node.js process with a non-zero exit c ode.
driver.get('www.google.com').catch(err => console.log(err))
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
change line 6 to
driver.get('www.google.com').catch(err => console.log(err))
– Josh
Sep 12 '18 at 20:27