querySelectorAll
returns a NodeList object (source) and not a DOM element. A NodeList object contains DOM elements.
Your code needs to change to get the first element and then call click()
:
document.querySelectorAll("li#credit")[0].click();
If you want to trigger the .click()
event to all elements you can do a for
loop
for(var i = 0; i<elems.length; i++) {
elems[i].click();
}