Puppeteer 中文文档v25.8.0

ElementHandle.click() 方法

此方法在需要时将元素滚动到视图中,然后使用 Page.mouse 点击元素的中心。如果元素已从 DOM 中分离,该方法会抛出错误。

签名

class ElementHandle {
  click(
    this: ElementHandle<Element>,
    options?: Readonly<ClickOptions>,
  ): Promise<void>;
}

参数

参数

类型

说明

this

ElementHandle<Element>

options

Readonly<ClickOptions>

(可选)

返回值:

Promise<void>