I am trying to just report back all checkboxes in Gmail for a small background script. Eventually i want to return only those that are checked. The checkboxes that are beside each email, used to select them and operate them, are indicated by role=”checkbox”.
With current code, i only get an empty list, and i can’t figure out why. Here is my code:
background.js
console.log("Start");
browser.contextMenus.create(
{
id: "AlertTest",
title: "Test2",
contexts: ["all"],
},
() => void browser.runtime.lastError,
);
browser.contextMenus.onClicked.addListener((info, tab) => {
switch (info.menuItemId) {
case "AlertTest":
//console.log(info.selectionText);
var ele = document.querySelectorAll("[role=checkbox]");
console.log(ele);
break;
}
});
function onError(error) {
console.log(error);
}