Hello,
I am trying to checking checkboxes in a range from 1 to 2000 using Run JavaScript function on web page action. The script runs without errors, but the checkboxes are not getting checked.
JavaScript Code I am Using:
// Define the start and end indices for the range
var startIndex = 1; // Start index (1-based)
var endIndex = 2000; // End index (1-based)
for (var i = startIndex; i <= endIndex; i++) {
// Construct the dynamic selector for each checkbox
var selector = "#imageRepeater__ctl" + i + "_chkAssign";
// Find the checkbox element
var checkbox = document.querySelector(selector);
// If the checkbox exists, check it
if (checkbox) {
checkbox.checked = true;
}
}
}
- No Errors: The script runs without errors, but the checkboxes are not getting checked.
- I Tried: I tested the JavaScript code directly in the browser's Developer Tools Console, and it works when checking individual checkboxes (e.g.,
// Define the range of checkboxes to select
var startIndex = 1; // Start index (1-based)
var endIndex = 3; // End index (1-based)).// Loop through the range and select the checkboxes
for (var i = startIndex; i <= endIndex; i++) {
var selector = "#imageRepeater__ctl" + i + "_chkAssign"; // Dynamic selector
var checkbox = document.querySelector(selector); // Find checkbox
if (checkbox) {
checkbox.checked = true; // Check the checkbox
console.log("Checked: " + selector);
} else {
console.log("Checkbox not found: " + selector);
}
}
- Browser Attachment: The browser is launched using the Launch Browser action.


Report
All responses (
Answers (