DOM要素が存在しないアプリをAIに操作させる — Flutter/canvas製エディタを座標だけで攻略する手順Flutter and canvas-based apps expose no DOM elements, making conventional AI…
FlutterやcanvasベースのアプリはDOM要素を持たないため、通常のAI操作手法が通用しない。本記事ではスクリーンショットと座標情報のみを使ってMCP経由でAIにUI操作させる具体的な手順を解説している。
Flutter and canvas-based apps expose no DOM elements, making conventional AI automation impossible. This article explains a practical method to let an AI agent control such UIs via MCP using only screenshots and screen coordinates.
AI 生成の要約と解説(解説は要約と収集メタデータに基づく)で、元記事全文の転載・翻訳ではありません。日本語版と英語版は言語ごとに独立して生成しています。正確性は元記事 (zenn.dev) でご確認ください。AI-generated summary and explainer (the latter based on the summaries and collected metadata), not a copy or translation of the full source article. Generated independently for each language. Verify accuracy at the original source (zenn.dev).
DOM要素なし
Flutter WebやcanvasでUIを描画するアプリでは、通常のHTMLページを対象とした要素ベースのAI操作が通用しない。本記事は、スクリーンショットと画面座標だけを使い、MCP経由でAIにこうしたUIを操作させる手順を扱っている。
canvas描画
画面上にボタンやパネルが見えていても、それらはDOM要素ではなく、1枚のcanvas上に描かれたピクセルにすぎない。そのため、findで対象を探しても何も返らず、read_pageで取得するアクセシビリティツリーも実質的に空になる。
座標で操作
要素を特定できない環境では、スクリーンショットから操作対象の位置を読み取り、その座標情報を用いてAIエージェントにUIを操作させる。記事では、Flutter製のアニメーション制作ツールであるRiveエディタを対象に、この座標ベースの方法を具体化している。
Flutter and canvas-based apps
Flutter Web and canvas-based applications expose no DOM elements, so conventional element-based AI automation does not work. This matters because controls that are visible on screen cannot be located or read through the methods used for ordinary HTML pages.
Buttons and panels in these interfaces are not represented as individual DOM elements. Instead, the interface is drawn as pixels on a single canvas. As a result, find returns nothing, while the accessibility tree exposed through read_page is effectively empty. The element-based approach described as the most reliable option for standard HTML pages is therefore fundamentally unavailable.
Screenshots and screen coordinates
The article explains a practical alternative that uses only screenshots and screen-coordinate information. Through MCP, an AI agent can operate the interface by interpreting what is visible in a screenshot and targeting controls according to their coordinates.
This coordinate-based procedure is presented for interfaces such as the Rive editor, an animation-production tool built with Flutter. It replaces DOM-based targeting with direct interaction at specific positions on the rendered interface.
ポコとTECHガイドPoko & TECH Guide
ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.
- ポコPokoFlutterのアプリって、画面のボタンがDOMに存在しないの? AIはどうやって操作するんだろう?Wait, Flutter apps have no buttons in the DOM at all? So how does an AI even operate them?
- TECHガイドTECH Guideこの記事だと、全部が1枚のcanvasに描かれたピクセルなんです。だからスクリーンショットを見て座標をクリックする方法になります。In this article, everything is pixels drawn on a single canvas. So the method is to look at a screenshot and click coordinates.
- ポコPokoじゃあ普通のWebページでも座標でクリックすればいいの? それとも違うのかな。So should we just click coordinates on normal web pages too? Or is that different?
- TECHガイドTECH Guideいえ、座標操作は壊れやすいので通常のWebでは勧めていません。read_pageでノードがほぼ返らない時だけ切り替える、という使い方です。Not quite. Coordinate clicking is fragile, so it's not recommended for normal web pages. Switch only when read_page returns almost no nodes.
- ポコPoko要素が取れない時の最後の手段なんだね。でも座標って、ズレたりしない?So it's a last resort when elements can't be read. But can coordinates drift?
- TECHガイドTECH Guideはい、読み込み直後は幅が確定せず右にズレます。innerWidthが同値になるまで待ち、devicePixelRatioが変わっていないかも確認するのが大事です。Yes, right after loading the width isn't settled and clicks land too far right. Wait for innerWidth to match, and check devicePixelRatio hasn't changed.
匿名の公開いいねです。記事の保存・お気に入りではなく、Featured、Top 3、重要度、掲載順位には影響しません。仕組みとプライバシーAnonymous public likes are reactions, not saved articles or bookmarks. They do not affect Featured, Top 3, importance, or listing order.How it works and privacy



