| <!-- webkit-test-runner [ useFlexibleViewport=true textExtractionEnabled=true ] --> |
| <!DOCTYPE html> |
| <html> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta charset="utf-8"> |
| <head> |
| <style> |
| .text-representation { |
| white-space: pre-wrap; |
| } |
| |
| .clickable { |
| background-color: lightblue; |
| padding: 10px; |
| margin: 5px; |
| cursor: pointer; |
| } |
| |
| .focusable { |
| border: 2px solid green; |
| padding: 5px; |
| margin: 3px; |
| } |
| |
| .interactive { |
| background-color: lightyellow; |
| padding: 8px; |
| } |
| </style> |
| <script src="../../resources/ui-helper.js"></script> |
| </head> |
| <body> |
| <div role="banner"> |
| <h1 id="main-title" aria-label="Main Page Title">Welcome to Test Page</h1> |
| </div> |
| <nav role="navigation" aria-label="Main navigation"> |
| <ul> |
| <li><a href="mailto:wenson_hsieh@apple.com" onclick="return false;">Section 1</a></li> |
| <li><a href="https://example.com/" onclick="return false;">Section 2</a></li> |
| </ul> |
| </nav> |
| <main role="main"> |
| <section id="section1" aria-label="Interactive Elements"> |
| <button class="clickable" onclick="console.log('clicked')" aria-label="Test button" aria-describedby="btn-help">Click Me</button> |
| <div id="btn-help" aria-hidden="true">This button does nothing</div> |
| <input type="text" class="focusable" placeholder="Enter text here" onfocus="this.style.backgroundColor='yellow'" onblur="this.style.backgroundColor=''" aria-required="true" aria-invalid="false" /> |
| <div class="interactive" tabindex="0" title="Test action" role="button" onclick="this.textContent = 'Clicked!'" onkeydown="if(event.key==='Enter') this.click()" aria-pressed="false">Clickable Div</div> |
| </section> |
| <section id="section2" aria-label="Content with Roles"> |
| <article role="article"> |
| <header> |
| <h3>Article Title</h3> |
| <time datetime="2024-01-01">January 1, 2024</time> |
| </header> |
| <p>This is some article content with <mark>highlighted text</mark>.</p> |
| </article> |
| <aside role="complementary" aria-label="Related information"> |
| <h4>Related Links</h4> |
| <ul> |
| <li><a href="https://webkit.org" onmouseover="this.style.color='red'">Example Link</a></li> |
| <li><a href="https://apple.com" onmouseout="this.style.color=''">Test Link</a></li> |
| </ul> |
| </aside> |
| <div role="region"> |
| <div role="status" aria-live="polite" id="status-msg">Ready</div> |
| <button onclick="document.getElementById('status-msg').textContent = 'Updated!'">Update Status</button> |
| </div> |
| <textarea rows="15" cols="40">This is a text box</textarea> |
| <div contenteditable role="textbox"> |
| <sub>WebKit home page:<a href="https://webkit.org">webkit.org</a></sub> |
| </div> |
| <form name="signup" autocomplete="on"> |
| <h4>Sign up for our newsletter</h4> |
| <input name="username" placeholder="Username" minlength="3" maxlength="20" required /> |
| <input name="email" placeholder="Email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" required /> |
| <input name="zipcode" placeholder="Zip Code" pattern="[0-9]{5}" minlength="5" maxlength="5" /> |
| </form> |
| </section> |
| </main> |
| <footer role="contentinfo"> |
| <p>Footer content with <span role="img" aria-label="copyright symbol">©</span> 2024</p> |
| </footer> |
| <div role="dialog" aria-hidden="true" style="display: none;"> |
| <p>This dialog is hidden and should not be extracted.</p> |
| </div> |
| <script> |
| addEventListener("load", async () => { |
| if (!window.testRunner) |
| return; |
| |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| |
| const results = []; |
| for (let outputFormat of ["texttree", "html"]) { |
| const heading = document.createElement("h1"); |
| heading.textContent = `-- ${outputFormat}`; |
| |
| const container = document.createElement("pre"); |
| container.classList.add("text-representation"); |
| container.textContent = await UIHelper.requestDebugText({ |
| normalize: true, |
| includeRects: false, |
| includeURLs: false, |
| nodeIdentifierInclusion: "editableOnly", |
| includeEventListeners: false, |
| includeAccessibilityAttributes: true, |
| includeTextInAutoFilledControls: true, |
| outputFormat, |
| }); |
| results.push(heading); |
| results.push(container); |
| results.push(document.createElement("br")); |
| } |
| |
| document.body.replaceChildren(...results); |
| testRunner.notifyDone(); |
| }); |
| </script> |
| </body> |
| </html> |