AppleScript

AppleScript is a scripting language that makes possible direct control of scriptable applications and of many parts of the Mac OS. A scriptable application is one that makes its operations and data available in response to AppleScript messages, called Apple events.
With scriptable applications, users can write scripts to automate operations, while developers can use AppleScript as an aid to rapid prototyping and automated testing. Developers can also use technologies including Apple events, AppleScript, Automator, and Scripting Bridge, to take advantage of services provided by other applications and by the Mac OS

Abrir Safari, hacer clic en una posición del navegador y después cerrarlo

Sentencia condicional (if-else)

If

If-else

Mostrar enlaces de una web en Safari usando JavaScript