| <!-- 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> |
| <script src="../../resources/js-test.js"></script> |
| <script src="../../resources/ui-helper.js"></script> |
| <style> |
| .offscreen { |
| position: absolute; |
| top: 101vh; |
| left: 0; |
| } |
| |
| body { |
| width: 100%; |
| height: 200vh; |
| } |
| </style> |
| </head> |
| <body> |
| <button id="offscreen-button" class="offscreen" aria-label="Offscreen Button">Click Me</button> |
| <h1 class="click-count">0</h1> |
| <script> |
| jsTestIsAsync = true; |
| |
| addEventListener("load", async () => { |
| clickCount = document.querySelector(".click-count"); |
| |
| document.getElementById("offscreen-button").addEventListener("click", () => { |
| clickCount.textContent = parseInt(clickCount.textContent) + 1; |
| }); |
| |
| if (!window.testRunner) |
| return; |
| |
| const debugText = await UIHelper.requestDebugText({ |
| nodeIdentifierInclusion: "interactive", |
| includeAccessibilityAttributes: true, |
| eventListenerCategories: ["all"], |
| }); |
| |
| clickError = await UIHelper.performTextExtractionInteraction("click", { |
| nodeIdentifier: UIHelper.nodeIdentifierFromDebugText(debugText, "Offscreen Button") |
| }); |
| |
| shouldBeEqualToString("clickError", ""); |
| shouldBeEqualToString("clickCount.textContent", "1"); |
| |
| finishJSTest(); |
| }); |
| </script> |
| </body> |
| </html> |