Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const selectCheckboxesByJobDescription = (searchText) => {
- const jobDescriptions =
- [...document
- .querySelectorAll('td div.word-break a.job-method')
- .values()];
- const selectionCount =
- jobDescriptions.reduce((count, description) => {
- if (description.textContent.trim().includes(searchText)) {
- const tr = description.closest('tr');
- const checkbox = tr.querySelector('input[type="checkbox"]');
- checkbox.checked = true;
- count++;
- }
- return count;
- }, 0);
- if (selectionCount > 0) {
- const actionButtons =
- document.querySelectorAll('button.js-jobs-list-command');
- actionButtons.forEach((buttion) => {
- buttion.disabled = false;
- });
- }
- return selectionCount;
- }
- const searchText = "TrackAppCrashesJob";
- const selectedCount = selectCheckboxesByJobDescription(searchText);
- console.log("Number of selected rows:", selectedCount);
Advertisement
Add Comment
Please, Sign In to add comment