addScriptTag method
Adds a <script>
tag into the page with the desired url or content.
Shortcut for Page.mainFrame.addScriptTag
.
Parameters:
url
: URL of a script to be added.
file
: JavaScript file to be injected into frame
content
: Raw JavaScript content to be injected into frame.
type
: Script type. Use 'module' in order to load a Javascript ES6 module.
See script
for more details.
Returns a Future<ElementHandle> which resolves to the added tag when the script's onload fires or when the script content was injected into frame.
Implementation
Future<ElementHandle> addScriptTag(
{String? url, File? file, String? content, String? type}) {
return mainFrame.addScriptTag(
url: url, file: file, content: content, type: type);
}