12 lines
565 B
JavaScript
12 lines
565 B
JavaScript
const browser = require('../browser');
|
|
|
|
module.exports = async () => {
|
|
await browser.start();
|
|
const buttons = await browser.evaluateJS(() => {
|
|
return Array.from(document.querySelectorAll('button, input[type="submit"], input[type="button"], [role="button"], a.btn, a.button'))
|
|
.map(el => ({ text: (el.innerText || el.value || el.getAttribute('aria-label') || '').trim(), type: el.tagName.toLowerCase(), id: el.id || null }))
|
|
.filter(b => b.text !== '');
|
|
});
|
|
return { success: true, action: 'get_buttons', count: buttons.length, buttons };
|
|
};
|