OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | |
4 <script> | |
5 | |
6 function test() | |
7 { | |
8 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument); | |
9 | |
10 function onGotDocument(msg) | |
11 { | |
12 if (msg.error) { | |
13 InspectorTest.log(msg.error.message); | |
14 InspectorTest.completeTest(); | |
15 return; | |
16 } | |
17 var rootNode = msg.result.root; | |
18 InspectorTest.sendCommand("DOM.querySelector", { "nodeId": rootNode.node
Id, "selector": "input" }, onQuerySelector); | |
19 } | |
20 | |
21 function onQuerySelector(msg) | |
22 { | |
23 if (msg.error) { | |
24 InspectorTest.log(msg.error.message); | |
25 InspectorTest.completeTest(); | |
26 return; | |
27 } | |
28 var node = msg.result; | |
29 InspectorTest.sendCommand("Accessibility.getAXNodeChain", { "nodeId": no
de.nodeId, "fetchAncestors": true }, onGotAccessibilityNodes.bind(null, node)); | |
30 } | |
31 | |
32 function onGotAccessibilityNodes(domNode, msg) | |
33 { | |
34 if (msg.error) { | |
35 InspectorTest.log(msg.error.message); | |
36 InspectorTest.completeTest(); | |
37 return; | |
38 } | |
39 | |
40 // nodeId isn't always the same, so set it to a known value if it's pres
ent | |
41 if (msg.result && "nodes" in msg.result) { | |
42 for (node of msg.result.nodes) { | |
43 if ("nodeId" in node) | |
44 node.nodeId = "<id>"; | |
45 } | |
46 } | |
47 | |
48 InspectorTest.log('result: ' + JSON.stringify(msg.result, null, " ")); | |
49 InspectorTest.completeTest(); | |
50 } | |
51 } | |
52 | |
53 </script> | |
54 </head> | |
55 <body onLoad="runTest();"> | |
56 <div role="main"> | |
57 <div role="article" aria-label="Top story"> | |
58 <input type="text"></input> | |
59 </div> | |
60 </div> | |
61 </body> | |
62 </html> | |
OLD | NEW |