If you need this, I pity you. I built it to automate some browser-based software. You may find some of the Safari-interacting/monitoring code useful.