const browser = require('../browser'); module.exports = async ({ selector = 'input, textarea, select' }) => { await browser.start(); const inputs = await browser.evaluateJS(` (function() { return Array.from(document.querySelectorAll('${selector}')).map(function(el) { return { tag: el.tagName.toLowerCase(), id: el.id || null, name: el.name || null, type: el.type || null, placeholder: el.placeholder || null, value: el.value || '', checked: el.checked || null, required: el.required || false, disabled: el.disabled || false }; }); })() `); return { success: true, action: 'get_input_values', count: inputs.length, inputs }; };