Estoy tratando de hacer una extensión de Google Chrome que marcará automáticamente la tercera casilla de verificación (Hansen Dam) en un sitio web de terceros. Parece que no puedo hacer que funcione.
Aquí está el sitio web: https://cityofla.ezlinksgolf.com/index.html#/preSearch
manifiesto.json
{ "manifest_version": 2, "name": "Tester", "version": "1.0.0", "permissions": ["activeTab"], "content_scripts": [ { "matches": ["<all_urls>"], "all_frames": true, "js": ["Scripts/content.js"] } ] }contenido.js
// trying to check the 3rd box directly, method 1 const a=document.querySelectorAll('input[type="checkbox"]'); a[3].checked = true; // i've tried checking all the boxes with a loop, method 2 var arr = []; const allInputs = document.getElementsByTagName("input"); for (let i = 0; i < allInputs.length; i++){ if (allInputs[i].type == 'checkbox') allInputs[i].checked = true; arr.push(i); // make a new array of only checkboxes, to pick 3rd checkbox from this array } // trying another way, method 3 arr[3].checked = true;¡Cualquier ayuda apreciada!