23 lines
431 B
JavaScript
23 lines
431 B
JavaScript
const browser = require('../browser');
|
|
|
|
module.exports = async ({ selector, timeout = 15000 }) => {
|
|
if (!selector) {
|
|
throw new Error('Selector é obrigatório');
|
|
}
|
|
|
|
await browser.start();
|
|
const p = await browser.ensurePage();
|
|
|
|
const el = await p.waitForSelector(selector, {
|
|
timeout,
|
|
state: 'attached'
|
|
});
|
|
|
|
return {
|
|
success: true,
|
|
action: "wait_for_selector",
|
|
selector,
|
|
found: !!el
|
|
};
|
|
};
|