16 lines
626 B
JavaScript
16 lines
626 B
JavaScript
const browser = require('../browser');
|
|
|
|
module.exports = async () => {
|
|
await browser.start();
|
|
const forms = await browser.evaluateJS(() => {
|
|
return Array.from(document.querySelectorAll('form')).map(form => ({
|
|
action: form.action || null,
|
|
method: form.method || 'GET',
|
|
fields: Array.from(form.querySelectorAll('input, textarea, select')).map(input => ({
|
|
name: input.name || null, type: input.type || input.tagName.toLowerCase(), placeholder: input.placeholder || '', id: input.id || null
|
|
}))
|
|
}));
|
|
});
|
|
return { success: true, action: 'get_forms', count: forms.length, forms };
|
|
};
|