Looking for an Safari extension (or plugin) what acts as mozrepl, what works like a charm. :)

  • Exists such thing?

If not, is possible somewhat easily control Safari from external scripts (perl, python, bash)? With control mean:

  • GET urls (mean http GET method) - Via safari (e.g. the Safari will send the auth, session cookies, referere and so on).
  • get source of the page (after the Safari renders all ajax calls and such)
  • POST via Safari (for example using AJAX - but initieted from teh external script)
  • etc...
  • in short like: "mozrepl" :)

Seems, here is nothing comparable yet. I didn't delete the question, is someone found such thing - please add an answer.

Ps: i know, how to use curl or like tools, but this isn't helps for e.g. grabbing a content of pages, where Safari managing the session authentication, cookies, referrers , user-agent strings and so on. Everything is rev-engineerable, but it is much easier to use a tool like mozrepl as doing the fullstack rev-engineering for getting scriptable web-sessions...)

  • Try applescript
    – mmmmmm
    Commented Sep 15, 2014 at 12:44
  • 1
    @Mark It is not exactly an Safari Extension or plugin, but can you please be more chatty and show me how to do it in the answer? Would be happy accept it. Thanx in advance. :)
    – clt60
    Commented Sep 15, 2014 at 13:15

1 Answer 1


If the main idea is scripting Safari, I would try using Automator before trying AppleScript. I'd start by hitting the record button and then:

  • Open Safari
  • Navigate to your webpage
  • GET by saving the webpage source
  • Allow the page to do whataver AJAX calls you may want it to do
    • save the webpage source again
  • Fill out a form, hit submit for your POST
    • save the webpage source yet again

Or you could try AppleScript with something like this:

tell application "Safari"
    tell window 1
    set current tab to (make new tab with properties {URL:"http://www.example.com"})
    end tell
end tell

You can add to the script form fills and submit buttons with javascript:

do JavaScript "document.getElementById('field').value = '" & myvalue & "'"
do JavaScript "document.forms[\"form\"].submit();"

I'd try this out within the JavaScript console within a web browser first to make sure you have the names of everything correct.

  • thanx for the answer - i'm looking for how to achieve scriptable safari using external scripts (Terminal.app & command line = e.g. bash/perl/python...
    – clt60
    Commented Sep 15, 2014 at 22:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .