I have been scouring the forums trying to figure out how to select a popup box in a javascript web form but haven’t had any luck.
There is a webpage that contains a form (in a frame) that I need to set to a certain value.
One of my issues, is that I can’t figure out how to know what the index # is for the form or the elements. I have tried scripting it via name, but that isn’t working either.
Here is what I have been trying, changing things around a little, but it’s not working. Most of it is parts of scripts that I have found on these forums already.
set locationselection to "document.forms[\"locations\"].elements[\"LocationName\"].selectedIndex=\"Honolulu\"
document.forms[\"locations\"].GetRecords()"
tell application "Safari"
activate
open location "url to site"
if my page_loaded(20) is false then return
do JavaScript "window.frames[1].document.forms[\"locations\"].elements[\"LocationName\"].selectedIndex=\"Honolulu\"" in document 1
do JavaScript locationselection in document 1
end tell
on page_loaded(timeout_value)
delay 2
repeat with i from 1 to the timeout_value
tell application "Safari"
if (do JavaScript "document.readyState" in document 1) is "complete" then
return true
else if i is the timeout_value then
return false
else
delay 1
end if
end tell
end repeat
return false
end page_loaded
The source for the frame is this
Please Select Your Location | --Select----- long list of options -- |
Any help would be greatly appreciated.
Thanks
djeans
Model: MacbookPro 17 CoreDue
Browser: Safari 528.16
Operating System: Mac OS X (10.5)