My problem appears to be quite similar to this problem: Document.querySelector returns null until element is inspected using DevTools, however there are some significant differences that are quite confusing and suggest that the problem may be different. I’m trying to write code that replaces text in the…
Tag: selectors-api
Selecting element from DOM with Puppeteer and Node
I am using Node and Puppeteer to scrape some information from webpage I am having issues with selecting the right elements. This describes the exact situation. I want to select only the ‘Hello’ text which is always in the first child. The only difference is that there are like 50 pieces of DOM exa…
querySelectorAll for element contain specific class
I have few divs that contain two classes such as this: where {{month.year + ‘-‘ + month.monthName + ‘-‘ + ‘end’}} for a certain month is 2018-August-end I want to select the divs that contain only 2018-August-end which I store into a variable so I tried something like this …
Getting selected options with querySelectorAll
I wonder if it’s possible in Javascript to get the currently selected options in a <select multiple> field using the Selctors API rather than a “stupid” iteration over all options. select.querySelectorAll(‘option[selected=”selected”]’) only returns the options t…
How to remove elements that were fetched using querySelectorAll?
This seems like something that would have a quick answer, but I can’t find one. Maybe I’m searching the wrong terms? No libraries please, though I don’t need cross-browser fallbacks, I’m targeting all the latest versions on this project. I’m getting some elements: This is working…