do JavaScript HELP NEEDED targeting a frame of a webpage in SAFARI

Hello fellow scripters,

I have an Applescript that posts a value in a form field using “do JavaScript”. Everything works fine when the page containg the form is open in its own window. However, when the form is contained in a frame of a webpage it does not work. Any help would be greatly appreciated.


tell application "Safari" to do JavaScript ("document.forms[0].Task.value = '" & "PLACE FORM VALUE HERE" & "';") in document 1

If you know the form is always in the second frame (for example), you might try this JavaScript:

window.frames[1].document.forms[0].Task.value = .

Safari and Firefox both support the frames object of the window. I do not know about other browsers.


Thanks you! Thank you! Thank you!

worked nicely!