chromium/headless/test/data/protocol/input/resources/focus-blur-notifications.html

<!DOCTYPE html>
<html lang="en">
  <script>
    let counter = 0;

    function onLoad() {
      setTimeout(swapFocus, 0);
    }

    function swapFocus() {
      const id = 'button' + (1 + (counter++ & 1));
      document.getElementById(id).focus();

      if (counter === 4) {
        console.log('quit');
      } else {
        setTimeout(swapFocus, 0);
      }
    }

    function onFocus(id) {
      console.log('onfocus ' + id);
    }
    function onBlur(id) {
      console.log('onblur  ' + id);
    }
  </script>

  <body onload="onLoad()">
    <div>
      <button id="button1" class="button"
        onfocus="onFocus('button1')" onblur="onBlur('button1')">
      Button1
      </button>
    </div>
    <div>
      <button id="button2" class="button"
        onfocus="onFocus('button2')" onblur="onBlur('button2')">
      Button2
      </button>
    </div>
  </body>

</html>