How to cut a record on nodejs puppeteer?

Use node.js, puppeteer. There is such code
let clicked_editorial_button = await page.evaluate(() => {
 if(document.querySelector("button.section-editorial-button") !== null)
{
document.querySelector('button.section-editorial-button').click();
 return true;
}
else
{
 return false;
}
 });

Can this all be done via a function or method. Ideally, to be able to write this:
let clicked_editorial_button = await page.evaluate(() => {
 return document.click_or_return_false("button.section-editorial-button");
 });

Is it possible to register click_or_return_false for the document to work in any await page.evaluate?
April 3rd 20 at 17:35
0 answer

Find more questions by tags Node.js