chromium/third_party/blink/web_tests/http/tests/html/resources/details.html

<!DOCTYPE html>
<details>target</details>
<script>
  window.addEventListener('message', event => {
    if (event.data === 'find') {
      testRunner.findString('target', []);
    } else if (event.data === 'isexpanded') {
      const expanded = document.querySelector('details').hasAttribute('open');
      event.source.postMessage('expanded: ' + expanded, '*');
    }
  });
</script>