You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编写Apple Script自动勾选Safari‘Allow unsigned extensions’复选框遇错求助

Safari脚本无法点击“允许未签名扩展”复选框的解决办法

你编写的AppleScript能成功打开Safari开发者设置页面,但无法定位到“Allow unsigned extensions”复选框,核心原因是该复选框并非直接挂载在Developer窗口下,而是嵌套在更下层的UI元素(滚动区域)里。

修改后的可行脚本

tell application "System Events"
    tell process "Safari"
        set frontmost to true
        delay 1
        click menu item "Settings…" of menu "Safari" of menu bar 1
        delay 1
        click button "Developer" of toolbar 1 of window 1
        delay 1
        
        -- 先定位滚动区域,再查找目标复选框
        tell scroll area 1 of window "Developer"
            click checkbox "Allow unsigned extensions"
        end tell
    end tell
end tell

补充排查方法

如果上述脚本仍无法生效,可通过Xcode的辅助检查器确认准确的UI层级:

  • 打开Xcode,从菜单选择Xcode > Open Developer Tool > Accessibility Inspector
  • 激活检查器后,点击Safari开发者设置页面的目标复选框,即可查看完整的UI元素路径,照着路径调整脚本即可。

内容的提问来源于stack exchange,提问作者acornator

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 10:12:11