| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/protocol-test.js"></script> |
| <script> |
| window.addEventListener("load", function() { |
| document.querySelector("#second").addEventListener("focus", function() { |
| log("focused"); |
| }); |
| }); |
| |
| function test() |
| { |
| InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument); |
| |
| function onGotDocument(msg) { |
| if (msg.error) { |
| ProtocolTest.log(msg.error.message); |
| ProtocolTest.completeTest(); |
| return; |
| } |
| var node = msg.result.root; |
| InspectorProtocol.sendCommand("DOM.querySelector", { "nodeId": node.nodeId, "selector": "#second" }, onQuerySelector); |
| } |
| |
| function onQuerySelector(msg) { |
| if (msg.error) { |
| ProtocolTest.log(msg.error.message); |
| ProtocolTest.completeTest(); |
| return; |
| } |
| var node = msg.result; |
| InspectorProtocol.sendCommand("DOM.focus", { "nodeId": node.nodeId }, onFocus); |
| } |
| |
| function onFocus(msg) { |
| if (msg.error) |
| ProtocolTest.log(msg.error); |
| ProtocolTest.completeTest(); |
| } |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <input></input> |
| <input id="second"></input> |
| </body> |
| </html> |