12 lines
436 B
JavaScript
12 lines
436 B
JavaScript
const browser = require('../browser');
|
|
|
|
module.exports = async ({ selector = null }) => {
|
|
await browser.start();
|
|
if (selector) {
|
|
const html = await browser.evaluateJS((sel) => document.querySelector(sel)?.outerHTML || null, selector);
|
|
return { success: true, action: 'get_html', selector, html };
|
|
}
|
|
const html = await browser.content();
|
|
return { success: true, action: 'get_html', html: html.substring(0, 50000) };
|
|
};
|