jeudi 16 novembre 2023

xpath works in browser devtools but selenium cannot find element

steps: after login to techfetch.com, and click select all checkbox and click Multiple Quick Apply button.

Then: trying to check the "Attach Covering Letter" checkbox. I could find element in browser using //*[@id="chkCL"] xpath. But javascript nodejs script is not able to find element.

// url https://www.techfetch.com/js/js_applyemail.aspx?quickapply=true

let attachCoverCheckBox = await driver.findElement(By.xpath('//*[@id="chkCL"]'))
Process exited with code 1
Uncaught NoSuchElementError NoSuchElementError: Unable to locate element: //*[@id="chkCL"]
    at throwDecodedError (file:///C:/work/selenium/apply-jobs/node_modules/selenium-webdriver/lib/error.js:524:15)
    at parseHttpResponse (file:///C:/work/selenium/apply-jobs/node_modules/selenium-webdriver/lib/http.js:601:13)
    at execute (file:///C:/work/selenium/apply-jobs/node_modules/selenium-webdriver/lib/http.js:529:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
No debugger available, can not send 'variables'

browser dev tools xpath and ::before pesudo tags

trying to click "Attach Covering letter" checkbox on the quick apply screen of techfetch.com website. I am new to Selenium and This is my second selenium script. So, Please provide as much information you can.




Aucun commentaire:

Enregistrer un commentaire