web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Run JavaScript function on web page

(0) ShareShare
ReportReport
Posted on by 12

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:

function ExecuteScript() { 
    // Define the start and end indices for the range
    var startIndex = 1; // Start index (1-based)
    var endIndex = 2000;   // End index (1-based)
    // Loop through the range of checkboxes
    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.
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 659 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 386 Moderator

#3
chiaraalina Profile Picture

chiaraalina 290

Last 30 days Overall leaderboard