From http://www.cubemg.com/how-to-fill-out-forms-on-websites-with-applescript/
to inputByTagName(thetagName, num, theValue) tell application "Safari" do JavaScript " document.getElementsByTagName('" & thetagName & "')[" & num & "].value ='" & theValue & "';" in document 1 end tell end inputByTagName