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

historylife picture historylife  ·  3Comments

ngryman picture ngryman  ·  3Comments

namma-geniee picture namma-geniee  ·  3Comments

paulirish picture paulirish  ·  3Comments

ryanvincent29 picture ryanvincent29  ·  3Comments