3
I am using windows, using Node.js with Selenium to do automation of a website. my problem and they are giving error in function click().
Code below is the example already ready when type npm install Selenium-webdriver.
const webdrive = require('selenium-webdriver'), By = webdrive.By, until = webdrive.until; var driver = new webdrive.Builder().forBrowser('chrome').build(); driver.get('http://www.google.com/ncr') .then(_ => driver.findElement(By.name('q')).sendKeys('wiki')) .then(_ => driver.findElement(By.name('btnK')).click()) .then(_ => driver.wait(check_title, 1000)); function check_title() { var promise = driver.getTitle().then(function (title) { if (title === 'wiki - Google Search') { console.log('success'); return true; } else { console.log('fail -- ' + title); } }) return promise; }
Now follow the error that has returned to me...
DevTools listening on ws://127.0.0.1:54874/devtools/browser/78c2868b-41a2-4d72-8da9-95f6a3fd05ec //Aqui ele abriu o navegador e escreveu no bampo de busca. (node:924) UnhandledPromiseRejectionWarning: WebDriverError: element not interactable // aqui ele deu erro na parte do click() e saiu dando erro no resto... (Session info: chrome=73.0.3683.75) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.17134 x86_64) at Object.checkLegacyResponse (D:\Automacao site - Selenium\node_modules\selenium-webdriver\lib\error.js:585:15) at parseHttpResponse (D:\Automacao site - Selenium\node_modules\selenium-webdriver\lib\http.js:533:13) at Executor.execute (D:\Automacao site - Selenium\node_modules\selenium-webdriver\lib\http.js:468:26) at process._tickCallback (internal/process/next_tick.js:68:7) (node:924) 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:924) [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. PS D:\Automacao site - Selenium>