I am using the script below to tick all checkboxes on chrome (Dev Console), within the exception to not selec few boxes.
It does work on chrome and tick the boxes I needed, but when I hit submit nothing happens because its mandatory to select the boxes and looks like it not really selecting them and parsing it.
The only error message I see on the console even before to use the script is:
WebSocket connection to xyz.example.com failed.
I have tried on firefox as well with the same outcome.
// Find all checkboxes on the page
var checkboxes = document.querySelectorAll('input[type="checkbox"]');
// Define the texts to exclude
var excludedTexts = ['Firewall_Rule_Example_1'];
// Loop through each checkbox and check it, except for the checkboxes with the specified exact texts
for (var i = 0; i < checkboxes.length; i++) {
var checkbox = checkboxes[i];
var label = checkbox.nextElementSibling;
if (label && excludedTexts.includes(label.textContent.trim())) {
continue; // Skip the checkboxes with the excluded texts
}
checkbox.checked = true; // Check the other checkboxes
}
Tick the wanted boxes, it is ticking the boxes but when i hit submit on the form it completely ignores what was selected and not going forwarding as the selection is mandatory.
Trigger the change event:
checkbox.dispatchEvent(new Event('change', { bubbles: true }));