I’m using the"Set check box state on web page"action to select checkboxes, but I need to checkall"Temperature Sensor" checkboxes at once.
Is there a way to do this with just one action, or do I need separate actions for each checkbox?
How to Check Multiple Checkboxes with a Single "Set Check Box State" Action?
Hi
Use JavaScript to Check All "Temperature Sensor" Checkboxes
Insert a "Run JavaScript function on web page" action.
Use the following JavaScript code: document.querySelectorAll('input[type="checkbox"]').forEach(function(checkbox) {
if (checkbox.labels && checkbox.labels[0].innerText.includes("Temperature Sensor")) {
checkbox.checked = true;
}
});
Explanation:
querySelectorAll('input[type="checkbox"]'): Selects all checkboxes.
checkbox.labels[0].innerText.includes("Temperature Sensor"): Checks if the label contains the text "Temperature Sensor".
checkbox.checked = true: Checks the checkbox. Alternative
If the checkboxes don’t have labels, but instead have a name, id, or class attribute that includes "TemperatureSensor", you can modify the selector: document.querySelectorAll('input[type="checkbox"][name*="TemperatureSensor"]').forEach(cb => cb.checked = true);
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
Regards,
Riyaz
First, identify all checkboxes related to "Temperature Sensor" on the page.
Use a loop to iterate through each matching checkbox element and set its state to checked.
This requires capturing all those checkboxes as separate UI elements or by indexing them if they share similar selectors.
2.Inject JavaScript (if allowed):
If you can run JavaScript on the page via Power Automate's "Run JavaScript function on web page" action, you could run a script that finds all checkboxes with a certain attribute or label and checks them all at once.
Example query: document.querySelectorAll('input[type="checkbox"][data-label="Temperature Sensor"]').forEach(cb => cb.checked = true);
(Note:- if you got your solution you can mark as solution and gives kudos)
Thanks & Regards
Vishnu Reddy
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.