Uncaught (in promise) TypeError: Cannot read properties of null

I am receiving this error when I try to get a certain element on a webpage with the line of code below. When the website loads, the element is not there yet because you have to click on a link before that element loads. Is there a way to make the call to that line of code retry or wait until you click on the link on the website? const note = document.querySelector(".btn btn-info btn-note-edit btn-note-save submit note-edit-panel-box")
7 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
scottpopa
scottpopaOP•2y ago
Thanks for the response @stefan. We are looking to scrape it so that we are able to get the correct information to mount a component in a specific location depending on what they click on.
YAGPDB.xyz
YAGPDB.xyz•2y ago
Gave +1 Rep to @stefan
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
scottpopa
scottpopaOP•2y ago
The only issue is that it is never going to be the same button/link that gets clicked. It is always going to be different, so it will need to be dynamic. This is why I am trying to scrape the element. There are thousands of pages it could be on (same base URL) and different links it could be (different notes by different people)
Arcane
Arcane•2y ago
@ElasticIT-Scott has reached level 1. GG!
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server