3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
6 function logActiveElement() {
7 var el
= document
.activeElement
;
8 log(el
? (el
.id
|| el
.tagName
) : "(none)");
13 InspectorTest
.sendCommand("Runtime.evaluate", { "expression": "logActiveElement()" });
15 InspectorTest
.sendCommand("DOM.getDocument", {}, onGotDocument
);
17 function onGotDocument(msg
) {
19 InspectorTest
.log(msg
.error
.message
);
20 InspectorTest
.completeTest();
23 var node
= msg
.result
.root
;
24 InspectorTest
.sendCommand("DOM.querySelector", { "nodeId": node
.nodeId
, "selector": "#second" }, onQuerySelector
);
27 function onQuerySelector(msg
) {
29 InspectorTest
.log(msg
.error
.message
);
30 InspectorTest
.completeTest();
33 var node
= msg
.result
;
34 InspectorTest
.sendCommand("DOM.focus", { "nodeId": node
.nodeId
}, onFocus
);
37 function onFocus(msg
) {
39 InspectorTest
.log(msg
.error
);
41 InspectorTest
.sendCommand("Runtime.evaluate", { expression
: 'logActiveElement()' });
42 InspectorTest
.completeTest();
48 <body onload=
"runTest()">
50 <input id=
"second"></input>