![]() ![]() We’re essentially launching an instance of Chrome and setting it equal to our newly created browser variable. This is where we actually launch puppeteer. Now that we’ve outlined our main function, lets dive into its inner workings:Ĭonst browser = await puppeteer.launch() It will become clearer as we continue with the tutorial. It’s okay if none of this makes sense right now. Since we’re using an async function, we can use the await expression which will pause the function execution and wait for the Promise to resolve before moving on. When the async function finally returns a value, the Promise will resolve (or Reject if there is an error). Because this function is asynchronous, when it is called it returns a Promise. Something important to note is that our getPic() function is an async function and makes use of the new ES 2017 async/await features.
0 Comments
Leave a Reply. |