I am following a tutorial on how to set up selenium in a node environment: https://medium.com/dailyjs/how-to-setup-selenium-on-node-environment-ee33023da72d
After following some steps I get an error while testing. These are the steps that I followed: So first i initialize npm environment on windows: mkdir node_testing cd node_testing npm init -y npm install selenium-webdriver
then I installed chromedriver (105.0.5195.52) for chrome version 105.0.5195.102 (not the exact same version because there isn't one). I also added the chromedrivers path to system paths.
After that im asked to run the following code as a test but it results in an error:
const webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
const driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
driver.get('http://www.google.com').then(function(){
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver\n').then(function(){
driver.getTitle().then(function(title) {
console.log(title)
if(title === 'webdriver - Google Search') {
console.log('Test passed');
} else {
console.log('Test failed');
}
driver.quit();
});
});
});
Result: Google Chrome opens and the following prints in the terminal:
DevTools listening on ws://127.0.0.1:56409/devtools/browser/9b9b2e99-4bb1-4d8d-8939-c68b39c045b9
C:\Users\ibo\node_testing\node_modules\selenium-webdriver\lib\error.js:522
let err = new ctor(data.message)
^
ElementNotInteractableError: element not interactable
(Session info: chrome=105.0.5195.102)
at Object.throwDecodedError (C:\Users\ibo\node_testing\node_modules\selenium-webdriver\lib\error.js:522:15)
at parseHttpResponse (C:\Users\ibo\node_testing\node_modules\selenium-webdriver\lib\http.js:589:13)
at Executor.execute (C:\Users\ibo\node_testing\node_modules\selenium-webdriver\lib\http.js:514:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async thenableWebDriverProxy.execute (C:\Users\ibo\node_testing\node_modules\selenium-webdriver\lib\webdriver.js:740:17) {
remoteStacktrace: 'Backtrace:\n' +
'\tOrdinal0 [0x011CDF13+2219795]\n' +
'\tOrdinal0 [0x01162841+1779777]\n' +
'\tOrdinal0 [0x01074100+803072]\n' +
'\tOrdinal0 [0x0109E523+976163]\n' +
'\tOrdinal0 [0x0109DB93+973715]\n' +
'\tOrdinal0 [0x010BE7FC+1107964]\n' +
'\tOrdinal0 [0x010994B4+955572]\n' +
'\tOrdinal0 [0x010BEA14+1108500]\n' +
'\tOrdinal0 [0x010CF192+1175954]\n' +
'\tOrdinal0 [0x010BE616+1107478]\n' +
'\tOrdinal0 [0x01097F89+950153]\n' +
'\tOrdinal0 [0x01098F56+954198]\n' +
'\tGetHandleVerifier [0x014C2CB2+3040210]\n' +
'\tGetHandleVerifier [0x014B2BB4+2974420]\n' +
'\tGetHandleVerifier [0x01266A0A+565546]\n' +
'\tGetHandleVerifier [0x01265680+560544]\n' +
'\tOrdinal0 [0x01169A5C+1808988]\n' +
'\tOrdinal0 [0x0116E3A8+1827752]\n' +
'\tOrdinal0 [0x0116E495+1827989]\n' +
'\tOrdinal0 [0x011780A4+1867940]\n' +
'\tBaseThreadInitThunk [0x772BFA29+25]\n' +
'\tRtlGetAppContainerNamedObjectPath [0x774D7A9E+286]\n' +
'\tRtlGetAppContainerNamedObjectPath [0x774D7A6E+238]\n'
}
PS C:\Users\ibo\node_testing> [11296:19112:0911/155158.526:ERROR:device_event_log_impl.cc(214)] [15:51:58.526] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[11296:19112:0911/155158.531:ERROR:device_event_log_impl.cc(214)] [15:51:58.530] USB: usb_device_handle_win.cc:1048 Failed to read
descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Any suggestions are welcome Ive been stuck on this for days.