// ==UserScript==
// @name New Userscript
// @version 0.1
// @description Try to take over the world!
// @author You
// @match https://www.bibliotechediroma.it/opac/*
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
window.addEventListener('load', function() {
document.querySelector('#biblioteche summary').click();
document.querySelector('#biblioteche li.tutte a').click();
}, false);
})();
There selectors in the code you posted were slightly wrong.
Also, if you us the run-at header to tell Tampermonkey to inject your script after the DOMContentLoaded event was dispatched and listen for the load event, you can do away with the function that waits for the elements to show up.
Thank very much you James, it works! Is it possible let that script work also from this kind of page, where there’s only one button (Tutte le biblioteche) and there isn’t the button Apri la lista completa?