javascriptgoogle-chrome-extensionchrome-extension-manifest-v3clicking

Reading drop down lists and closing them with click


I'm making a browser extension reading data from the site. Currently I make reading a drop down list reading. Currently code looks like this:

const button = getDropDownListButton();
button.click();
readData();
const closer = getListCloserObject();
closer.click();

When i paste into the console code for closing this list it works, but not in extension. I know that click happens every time when in code called click() method. Lists open, i got data, but lists doesn't close. And in some time it seems like 2 lists opened at one time (they close each other on click).
P.S. Site seems like uses compiled React code so i don't know what happens on it, so i can't provide an example
P.P.S. As i sayed, lists close all other on opening. So, if i delete list as html object opening other list results in error. On click list opener creates an object containing invisible div on the whole screen deleting on click all object created by list button


Solution

  • Just mark readen items of list as readen and don't read them again. After reading complete, use intervals/timeouts to close