Here is how I'd code what you're trying to do and I've tested the following example AppleScript code and it works to achieve the objective.
if running of application "Google Chrome" then tell application "Google Chrome" to quit
delay 1
do shell script "open -a 'Google Chrome' --args --incognito http://www.schoolgen.co.nz/voteforyourschool/"
delay 1
tell application "Google Chrome"
activate
-- # Wait until page finishes loading.
repeat until (loading of active tab of front window is false)
delay 1
end repeat
tell active tab of front window
-- # Click the "Vote now" button for "Ahuroa School".
execute javascript "document.getElementsByClassName('flotediv col-md-3 col-xs-12 col-sm-6 flexbutton ')[77].click();"
delay 0.5
-- # Click the "Vote" button.
execute javascript "document.getElementsByClassName('votebutton')[0].click();"
delay 0.5
-- # Click the "Close" button.
execute javascript "document.getElementsByClassName('btn btn-default')[0].click();"
delay 0.5
end tell
quit
end tell
I've coded it so if Google Chrome is already open, it's first closed so it can be reopened in Incognito mode, then waits until the page is finished loading, while letting JavaScript handle the rest of what's necessary to achieve the goal, so UI Scripting e.g. "System Events" and keystroke command does not need to be used.
By the way, while most of your code worked there were two points of failure, one being execute javascript was not told where to do so, hence adding tell active tab of front window within the tell application "Google Chrome"block, and instead of using getElementsById, which would not work even with tell active tab of front window, I used getElementsByClassName instead, because it worked.
I've updated my answer again after played around with this a bit more. As presently coded, it doesn't need to search for "ahuroa" and instead just clicks the "Vote now" button for "Ahuroa School", which is "document.getElementsByClassName('flotediv col-md-3 col-xs-12 col-sm-6 flex button ')[77]", although that could possibly change. If it does you can either increment or de-increment the number or you can just use the following version of the code which ascertains the appropriate number for use with "document.getElementsByClassName('flotediv col-md-3 col-xs-12 col-sm-6 flex button ')[?]".
if running of application "Google Chrome" then tell application "Google Chrome" to quit
delay 1
do shell script "open -a 'Google Chrome' --args --incognito http://www.schoolgen.co.nz/voteforyourschool/"
delay 1
tell application "Google Chrome"
activate
-- # Wait until page finishes loading.
repeat until (loading of active tab of front window is false)
delay 1
end repeat
tell active tab of front window
-- # Click the "Vote now" button for "Ahuroa School".
set theCount to execute javascript "document.getElementsByClassName('schoolnameid').length;"
repeat with i from 0 to theCount
set theSchoolName to execute javascript "document.getElementsByClassName('schoolnameid')[" & i & "].innerText;"
if theSchoolName is "Ahuroa School" then
execute javascript "document.getElementsByClassName('flotediv col-md-3 col-xs-12 col-sm-6 flexbutton ')[" & i & "].click();"
exit repeat
end if
end repeat
delay 0.5
-- # Click the "Vote" button.
execute javascript "document.getElementsByClassName('votebutton')[0].click();"
delay 0.5
-- # Click the "Close" button.
execute javascript "document.getElementsByClassName('btn btn-default')[0].click();"
delay 0.5
end tell
quit
end tell
Note: The example AppleScript code is just that and does not employ any error handling and is meant only to show one of many ways accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.