give your ul an id
and then you can do the query below:
var arr=array();
var i=0;
var lists=document.querySelector("#ul_id").querySelectorAll("li");
[].forEach.call(
lists,
function(li){
array[i]=li.querySelector("h2").innerHTML;
}
);
there may be some syntax error.