慣性聚合 高效追讀感興趣之博客、新聞、科技資訊
閱原文 以慣性聚合開啟

推薦訂閱源

博客园 - 司徒正美
V
V2EX
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
月光博客
月光博客
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python)
吾之代理人可见下拉列表。然其无法选取任何项。
אחיה כהן · 2026-05-24 · via DEV Community

吏有牍。吾请其择一物。吏拒之。

Element not found

更之。犹同。

遂启工具,挲入:

document.querySelector('select[name="status"]')
// null

入全景式 出全景式

null。于显有选单之页。吾见之。吾触之。吾以指展之。然无故document.querySelector坚执其无。

此乃一谈三层DOM互不言语之故,及safari_select_optionSafari MCP之v2.11.3中,欲越此三层而达之学也.


其设

此页乃Salesforce/Lightning之支持表单,嵌于客户门户之中。门户为父文书。表单处<iframe> 闪电之舟自异域(同源)之主而出。其内,闪电自元素之图织其界面,各元素有独用之影根,各元素有自具之布局。

故当开发者于闪电撰“状态”之选单,其实际<select>元素终呈于类此之境:

top document
└── <iframe src="...lightning host...">
    └── <support-form>
        └── #shadow-root
            └── <lightning-status-field>
                └── #shadow-root
                    └── <select>   ← the element my agent needed

入全景模式 退出全屏模式

document.querySelector('select[name="status"]'),源自顶层文档,不涉及其间。非iframe,非阴影根。于其视之,<select>形同虚设。

何故困惑

二事使此不易察觉:

  1. safari_snapshot未见之。 代理取页之可及性影,则见下拉之选,具引、具标、具aria-expanded 之状、具项。无缺遗之憾。
  2. safari_click 之效彰。 吾数周矣,轻点深DOM之元,未尝思量。此启同表之钮,处异影根之内,点之则解,无滞碍焉。

故代理自忖曰:"吾方点此表单,下拉之选赫然在目,何不能择一物耶?"

然耻于言者,盖clickselect_option所用者,乃不同之寻器也.

二寻器,一未闻之器

Safari MCP于页内纳二元素解析径。

  • mcpFindRef(ref)— 既得引据自safari_snapshot, 循文书而行,遍历同源iframe,及可及之影根,以觅ref所指之素。
  • mcpQuerySelectorDeep(selector)— 既得CSS选择器,亦当深巡,惟以选择器相配,非以参照也。

点击者久用此二者。是故点击于闪电表单及React组件库与模态对话框之渲染门户,皆"自顺其然"。

safari_select_option,而点击者犹行此道:

var el = document.querySelector(sel);

全屏模式入 全屏模式出

仅一行。顶框而已。无iframe,无shadow root,无他物。于寻常之境<select>常页之中,此行无碍,自工具成之日便如此,故无人更之。

然一旦有用户将 Safari MCP 投入 Salesforce 之真实门户,是线于每呼皆谬。

其补

《v2.11.3之补丁甚微,其教之》safari_select_option何哉safari_click已知之矣

let finder;
if (ref) {
  finder = `mcpFindRef('${ref}')`;
} else if (selector) {
  finder = `(document.querySelector('${sel}')||mcpQuerySelectorDeep('${sel}'))`;
}

进入全屏模式 退出全屏模式

二途:

  • ref一途 — 乃用以寻诸物于 safari_snapshot。其解同于点击之深行者,若iframe、影根、嵌套组件之属皆可。
  • selector一途 — 当初以廉价之顶框查询,犹九五之数其效,若其返虚,则继之以深行者。

其器余事 — _valueTracker之重置,可醒React之控输入簿记;input之值、文、子串匹配,适于选器,其显文不等于其值者;change之/之/之……blur之事序未改。彼处未损。元素寻访如常。

全版v2.11.3之发布记事在此。

吾当早为之计者

此实情乃:吾有二寻器。一器用于点击。及撰select_option时,吾忘其存在。修复费时一辰。然此弊已存三月矣。

吾于造此器之中,屡屡重悟者,乃DOM之器,不宜有"坦途"之设。凡解元素之器,皆当如一,盖页不知次将呼何器也。入影根,试填一域,填器宜视点击之处。

safari_fillsafari_get_elementsafari_hoversafari_get_computed_style — 皆尝经此迁移于v2.x之序初,逐弊报而迁。safari_select_option乃余未察之终。v2.11.3遂合其隙。

若尔建browser自动化之器——无论MCP与否——则今夜当自问其码:凡我元素解析之径,其指“元素”为何,果能同乎?盖其日异,则代理者将自知之。


Safari MCP乃开源之器(MIT),存于github.com/achiya-automation/safari-mcp macOS 上 AI 代理之原生浏览器自动化——尔之真 Safari,尔之真登录,无 Chrome。