Puppeteer: frame.evaluateHandle()?

Created on 16 Oct 2017  路  3Comments  路  Source: puppeteer/puppeteer

Is there a reason why frames don't have evaluateHandle()? I'm trying to use it like below:

````
const windowHandle = await frame.evaluateHandle((selector) => {
// Do various things
return aDOMElement;
}, selector);

const elementHandle = windowHandle.asElement();
await elementHandle.click();
````

feature good first issue

Most helpful comment

Thanks @vsemozhetbyt, that's definitely a perfect workaround.

That being said, page and frame, up until now, have had similar methods. It feels off that this is missing.

All 3 comments

Doc states that page.evaluateHandle() is a shortcut for page.mainFrame().executionContext().evaluateHandle(). So it seems you can use frame.executionContext().evaluateHandle().

Thanks @vsemozhetbyt, that's definitely a perfect workaround.

That being said, page and frame, up until now, have had similar methods. It feels off that this is missing.

Please feel free to send a PR with frame.evaluateHandle method.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aslushnikov picture aslushnikov  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

historylife picture historylife  路  3Comments

denniscieri picture denniscieri  路  3Comments

sheweichun picture sheweichun  路  3Comments