Hamish released the first rb-appscript gem, paving the way for the new and improved SafariWatir. Now with non-sluggish performance! Seriously, my regression test script runs ridiculously fast on my MacBook Pro compared to previous versions of SafariWatir.
This performance boost comes as no surprise. Up until now I was doing the simplest most naive (and slowest) thing that could possible work by using backticks to invoke AppleScript from the command line...
`osascript <<SCRIPT
tell application "Safari"
do JavaScript "#{script}" in document 1
end tell
SCRIPT`.chomp
This got me started, but it turns out that using an Apple Event bridge like rb-appscript is more natural, and so much faster...
app = AS.app("Safari")
document = app.documents[1]
app.do_JavaScript(script, :in => document)
In unrelated news, my fellow Obtivian Tyler Jennings has submitted his first Rails patch.No comments yet.
You must be logged in to add your own comment.