addScriptTag method

Future<ElementHandle> addScriptTag({
  1. String? url,
  2. File? file,
  3. String? content,
  4. String? type,
})

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

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 _mainWorld.addScriptTag(
    url: url,
    file: file,
    content: content,
    type: type,
  );
}