I have written a script that I run through dev tools -> console in chrome that auto adds comments instead of writing and submitting one at a time:
/**
* Created by keilc on 2/09/2015.
*/
var leaveComment = document.getElementsByClassName('plain leaveComment');
var commentBox = document.getElementsByClassName('botmarg5px feedbacktextarea');
var submit = document.getElementsByClassName('siteButton bigButton');
var comment = "thankyou very much :)";
for(var i = 0; i <= leaveComment.length; i++)
{
// Click 'leave comment'
leaveComment[i].click();
// Leave comment
commentBox[i].value = comment;
// Submit the comment
submit.click();
}
The click(); event gets called successfully for each item in the leaveComment array but when it reaches the submit buttons the click(); method fails and returns Object doesn't support property or method 'click':
So I tried moving the click(); call on the submit buttons outside the for loop:
for(var i = 0; i <= leaveComment.length; i++)
{
// Click 'leave comment'
leaveComment[i].click();
// Leave comment
commentBox[i].value = comment;
}
// Submit the comment
submit.click();
but this give me Unable to get property 'click' of undefined or null reference error.
After trying these different approaches I am confused as to why the click(); method is working for the 'leave comment' link but not the submit button.

