There is a HTML page with a DIV element whose onclick event is triggered from Javascript in following way,

i.history= document.getElementById("history");
i.history.onclick = i.bookmarks.onclick = i.settings.onclick = function(e){
if(e.target.id === i.currentselection){
return;
}else{
receiveData();
}
}

This is a part of webpage and am trying to automate the same. while trying the below line

javascript:var el=document.getElementById('history');if (el.onclick) {el.onclick();} else if (el.click) {el.click();}

i get this error

06-10 10:57:12.750: E/Web Console(4845): Uncaught TypeError: Cannot read property 'target' of undefined at file:///data/data/com..page.html:1196

when i pass 'this' keyword and try this way

javascript:var el=document.getElementById('history');if (el.onclick) {el.onclick(this);} else if (el.click) {el.click(this);}

i get this exception.

06-10 11:48:01.735: E/Web Console(7964): Uncaught TypeError: Cannot read property 'id' of undefined at file:///data/data/com...page.html:1196


whereas normal document.getElementById('history').click() or document.getElementById('history').onclick(); doesn't work either.

What am i missing here? Why i am not able to perform click events. when i do get events, say get style attribute, class name, they work. Only for click i have issue.,