Autoclick on print confirmation

Hi, from a Chrome extension I would like to auto-click on (print) confirmation but this script partially works:

setTimeout(function()
{
  labels = document.querySelectorAll('label');
  if (labels[1].innerText == "Modello di stampa")
  {document.getElementsByClassName("button confirm")[0].click();}
},500);

Because the page refreshes repeatedly . Could you help me please? Thank you

Here is the snippet code of the copied static page (the site is restricted):
SebinaNEXT BIBLIOTECHE DI ROMA (w3spaces.com)

Please post all call (HTML, CSS, JavaScript), so we can test it.

Thanks RandellDawson, I linked the page but the host seems not accepted, where should I upload the page?

The page you linked to at the top does not have the code you referenced above (with the setTimeout).

The setTimeout is needed by the Chrome extension. The firs part of the script:

labels = document.querySelectorAll('label');
  if (labels[1].innerText == "Modello di stampa")

is a text present only on this page, added to prevent a popup opening on other pages.

FYI, the script for the “report” click (third small icon at the top from right to left) is identical but works well and without repetitions because it links to the next page and not to the same page:

setTimeout(function()
{
  labels = document.querySelectorAll('label');
  if (labels[1].innerText == "Modello di stampa")
    {document.getElementsByClassName("reports")[0].click();}
},2000);

Can I do something to avoid repeating clicks in the first script? Thanks