Closed adamgotterer closed 7 years ago
I'm trying to interact with getFrames but it doesn't return an object as the docs say, it actually returns a promise. I tried interfacing with the promise with no luck. How are you supposed to interact with it?
const HeadlessChrome = require('simple-headless-chrome') const browser = new HeadlessChrome({headless: true}) async function navigateWebsite() { await browser.init(); const mainTab = await browser.newTab({ privateTab: false }); await mainTab.goTo('http://www.rollingstone.com') await mainTab.wait(10000); const frames = mainTab.getFrames(); console.log(frames); await browser.close(); } navigateWebsite();
Promise { _bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _promise0: undefined, _receiver0: undefined }
Just add an await to that line, so that it reads:
await
const frames = await mainTab.getFrames()
Thank you! Still getting used to the await syntax :)
I'm trying to interact with getFrames but it doesn't return an object as the docs say, it actually returns a promise. I tried interfacing with the promise with no luck. How are you supposed to interact with it?