From e0f5b9392373b3a1d4214d27a36fb0c0a369792f Mon Sep 17 00:00:00 2001 From: Xingan Wang Date: Fri, 3 Nov 2017 00:05:38 -0700 Subject: [PATCH] feat(Frame): addStyleTag and addScriptTag now return ElementHandles. This patch teaches `page.addStyleTag` and `page.addScriptTag` to return ElementHandles to the added tags. Fixes #1179. --- docs/api.md | 4 ++-- lib/FrameManager.js | 34 ++++++++++++++++++++-------------- test/test.js | 19 ++++++++++++------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/docs/api.md b/docs/api.md index 5d1d0c44573..bc36b2e76a8 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1442,7 +1442,7 @@ const html = await frame.$eval('.main-container', e => e.outerHTML); - `url` <[string]> Url of a script to be added. - `path` <[string]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). - `content` <[string]> Raw JavaScript content to be injected into frame. -- returns: <[Promise]> which resolves when the script's onload fires or when the script content was injected into frame. +- returns: <[Promise]<[ElementHandle]>> which resolves to the added tag when the script's onload fires or when the script content was injected into frame. Adds a `