puppeteer/docs/api/puppeteer.page.addscripttag.md
jrandolf 5ff205dc8b
fix: extends ElementHandle to Nodes (#8552)
* fix: extends `ElementHandle` to `Node`s (#8552)
2022-07-06 09:05:37 +02:00

1.0 KiB

sidebar_label
Page.addScriptTag

Page.addScriptTag() method

Adds a <script> tag into the page with the desired URL or content.

Signature:

class Page {
  addScriptTag(options: {
    url?: string;
    path?: string;
    content?: string;
    type?: string;
    id?: string;
  }): Promise<ElementHandle<HTMLScriptElement>>;
}

Parameters

Parameter Type Description
options { url?: string; path?: string; content?: string; type?: string; id?: string; }

Returns:

Promise<ElementHandle<HTMLScriptElement>>

Promise which resolves to the added tag when the script's onload fires or when the script content was injected into frame.

Remarks

Shortcut for page.mainFrame().addScriptTag(options).