有没有办法在Web Inspector打开的情况下启动Safari?

时间:2012-06-15 13:51:01

标签: safari webkit

我必须关闭并重新打开它以用于开发目的,例如每天100次,并且打开Web检查器禁用缓存,清除缓存,开始调试javascript以及偶尔清除本地数据库所花费的额外时间变得乏味。

1 个答案:

答案 0 :(得分:1)

这是我写的AppleScript,它启动了Safari Inspector。您可以将其导出为可执行应用程序,并将其放置在Dock中,只需单击一下即可进入Inspector。您也可以在Xcode的构建阶段启动它,以便在您的应用程序发送到模拟器时运行它。根据需要将“iPad模拟器”更改为“iPone模拟器”或连接的设备。

tell application "Safari"
    activate
    delay 2
    tell application "System Events"
        tell process "Safari"
            set frontmost to true
            click menu item 2 of menu 1 of menu item "iPad Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
        end tell
    end tell
end tell
相关问题