<html>
<head>
<script src="../../resources/ui-helper.js"></script>
<style>
div {
    width: 400px;
    height: 400px;
}
</style>
<script>
async function test() {
    if (!window.testRunner || !testRunner.runUIScript)
        return;

    testRunner.dumpAsText();
    testRunner.waitUntilDone();

    document.body.addEventListener("click", function( event ) {
        result.innerHTML = "clicked";
    }, false);

    let element = document.getElementById("clickme");
    let rect = element.getBoundingClientRect();
    let x = rect.left + rect.width / 2;
    let y = rect.top + rect.height / 2;

    await UIHelper.activateAt(x, y);

    testRunner.notifyDone();
}
</script>
</head>
<body onload="test()">
<div id=clickme></div>
<pre id=result></pre>
</body>
</html>
