AppleScript to click buttons and close tabs Im not really familiar with applescript (using C/Python/Pacsal atm). So far did the autoclicker for my WoW ore prospection.

I would like to use the script on safari to click the link with name "1st Text goes here" to open new tab, then click other link "2nd Text goes here" and then close tab. (repeat n number of times)

My knowledges led me to the following.

tell application "Safari"

end tell


Hints and tips are also appreciated.
Assuming these links are going to be in the same place every time, I'd try Watch Me Do (open up Automator, tell it you want an application. There are lots of built-in actions in the "Internet" subsection of Library, Website Popup looks promising for you. 

If that all fails or you want something quick and dirty, pressing the Record button up at the top right will record your screen and keyboard inputs, as well as events for you. You could just code a loop to run the generated code over and over again N times, but be warned that Watch Me Do (the thing activated by record) is only screen scraping. If those links ever move or your window isn't in the same place, the script will bomb, probably clicking on things you don't want it to at all, so be careful!