Is this script possible with safari???

First off excuse my ignorance, I know nothing about creating applescripts, but I am trying to learn.
What I am trying to do is create a script that will open an page and then select(click) a certain javascript link, which will cause a window to open where a login button needs to be clicked(this step I may be able to do without). Is this posssible … am I off my rocker?

Any help would be greatly appreciated.


It is possible. You’ll need to see what the JavaScript code does and use Safari’s Do JavaScript command to run that (leave off the javascript: prefix). The hardest part is waiting to let the popup load before oyu do the next step.

Another useful piece of info: most HTML objects respond to the click() event, so to click a button named checkAddress in a form named myInfo, you’d do this:

tell app "Safari"
  do javscript "document.myInfo.checkAddress,click();" in document 1
end tell

Hope that helps.

Thanks Krioni for your help. The page I am trying to open is I am able to get that to open. There are several links on the page for selecting different radio stations. The one I want is WPEN and an example javascript for that link is …


Is there a way to get the applescript to select that javascript link (WPEN) everytime?

The source code from the login page contains this for the login button I think.

<input type="submit" value="Login &" class="btnGreen"


Well, is it the same code every time? If so, just put the code (starting with the void part) into the Do Javascript command. If it is different, you’ll have to read the source of the page, or find some other identifier. I assume the letters WPEN are somewhere near that link?

Hmm. No name for the button. That means you’d have to find out which element of the form it is numerically. Is it always, say, the 5th button?