safari-automation

safari-automation is a cursor rule for Cursor from roy2392/vibe-agents-rules. It costs 0 tokens per session (1,424 once invoked), scanned A, a copy of safari-automation, MIT.

A set of patterns for controlling Safari, Apple's web browser, with automation scripts during web testing or other browser tasks.

In plain words
What is it for?
Use it to open or reuse Safari windows and tabs, navigate to specific URLs, and structure predictable web UI automation.
Why use it?
Safari automation can lose track of the right window, tab, or page, making tests unreliable.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to open or reuse Safari windows and tabs, navigate to specific URLs, and structure predictable web UI automation.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/roy2392/vibe-agents-rules/safari-automation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/roy2392/vibe-agents-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for safari-automation

README.md
[![agentmods](https://agentmods.dev/badge/rules/roy2392/vibe-agents-rules/safari-automation/github.svg)](https://agentmods.dev/rules/roy2392/vibe-agents-rules/safari-automation)
Your own site
<a href="https://agentmods.dev/rules/roy2392/vibe-agents-rules/safari-automation"><img src="https://agentmods.dev/badge/rules/roy2392/vibe-agents-rules/safari-automation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for safari-automation

Your own site · 80×15
<a href="https://agentmods.dev/rules/roy2392/vibe-agents-rules/safari-automation"><img src="https://agentmods.dev/badge/rules/roy2392/vibe-agents-rules/safari-automation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,424 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01424
Opus 5 $0.00000 $0.00712
Sonnet 5 $0.00000 $0.00285
Haiku 4.5 $0.00000 $0.00142

Measured 9d ago against content hash bdf28d6069de, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

safari-automation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to safari-automation — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

project-rules/safari-automation.mdc · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Safari Automation Guide

This guide captures hard-won lessons from automating Safari interactions, particularly for web UI automation and testing.

Key Concepts

Managing Safari Windows and Tabs

Objective: Reliably direct Safari to specific URLs in a predictable way, preferably using a single, consistent browser window and tab.

Recommended Approach:

tell application "Safari"
  activate
  delay 0.2 -- Allow Safari to become the frontmost application
  if (count of windows) is 0 then
    -- No Safari windows are open, so create a new one.
    make new document with properties {URL:"http://example.com"}
  else
    -- Safari has windows open; use the frontmost one.
    tell front window
      set targetTab to missing value
      try
        -- Check if a tab for the target URL is already open
        set targetTab to (first tab whose URL starts with "http://example.com")
      end try
      
      if targetTab is not missing value then
        -- Reuse existing tab: refresh and make active
        set URL of targetTab to "http://example.com"
        set current tab to targetTab
      else
        -- No specific tab found: use current active tab
        set URL of current tab to "http://example.com"
      end if
    end tell
  end if
  delay 1 -- Pause to allow the page to begin loading
end tell

JavaScript Execution in AppleScript

String Escaping Strategies:

  1. Using Escaped Quotes:

    do JavaScript "document.querySelector('[data-testid=\\'my-button\\']').click();"
    
  2. Using character id 39 for Complex Strings:

    set sQuote to character id 39
    set jsSelector to "[data-testid=" & sQuote & "my-button" & sQuote & "]"
    set jsCommand to "document.querySelector(" & sQuote & jsSelector & sQuote & ").click();"
    do JavaScript jsCommand in front document
    
  3. XPath for Robust Element Selection:

    -- Find button containing specific text
    set jsCommand to "document.evaluate(\"//button[.//text()='Connect']\", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();"
    do JavaScript jsCommand in front document
    

Read the full file on GitHub · 203 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 203 lines · 0 tokens per session scan A bdf28d6069de

Subscribe to this mod's changes

safari-automation is a cursor rule published in the GitHub repository roy2392/vibe-agents-rules (11 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,424 tokens. A static security scan graded it A with 0 findings. It is 100% identical to safari-automation, differing in 0 lines, and is treated as a copy.