fix(PageController): same-origin iframe actions

This commit is contained in:
Simon
2026-03-21 01:46:09 +08:00
parent 93b1e52376
commit e98d80b6a0
3 changed files with 88 additions and 47 deletions

View File

@@ -18,6 +18,7 @@ import * as dom from './dom'
import type { FlatDomTree, InteractiveElementDomNode } from './dom/dom_tree/type'
import { getPageInfo } from './dom/getPageInfo'
import { patchReact } from './patches/react'
import { isAnchorElement } from './utils'
/**
* Configuration for PageController
@@ -243,7 +244,7 @@ export class PageController extends EventTarget {
await clickElement(element)
// Handle links that open in new tabs
if (element instanceof HTMLAnchorElement && element.target === '_blank') {
if (isAnchorElement(element) && element.target === '_blank') {
return {
success: true,
message: `✅ Clicked element (${elemText ?? index}). ⚠️ Link opened in a new tab.`,