@@ -133,6 +133,23 @@ function changeCurrLocation(tabObj, rootNode, index, name) {
133133 }
134134}
135135
136+ // get ax tree
137+ // function getAccessibilityTree(tabId) {
138+ // chrome.debugger.attach({ tabId: tabId }, '1.3', function () {
139+ // chrome.debugger.sendCommand({ tabId: tabId }, '1.3', 'Accessibility.enable', {}, function () {
140+ // chrome.debugger.sendCommand(
141+ // { tabId: tabId },
142+ // '1.3',
143+ // 'Accessibility.getFullAxTree',
144+ // {},
145+ // function (response) {
146+ // console.log(response);
147+ // },
148+ // );
149+ // });
150+ // });
151+ // }
152+
136153/*
137154 The 'chrome.runtime' API allows a connection to the background service worker (background.js).
138155 This allows us to set up listener's for when we connect, message, and disconnect the script.
@@ -248,6 +265,19 @@ chrome.runtime.onConnect.addListener((port) => {
248265 return true ;
249266
250267 case 'jumpToSnap' :
268+ // console.log('background.js: jumpToSnap:', getAccessibilityTree(tabId));
269+ chrome . debugger . attach ( { tabId : tabId } , '1.3' , ( ) => {
270+ chrome . debugger . sendCommand ( { tabId : tabId } , 'Accessibility.enable' , ( ) => {
271+ chrome . debugger . sendCommand (
272+ { tabId : tabId } ,
273+ 'Accessibility.getFullAXTree' ,
274+ { } ,
275+ ( response ) => {
276+ console . log ( response ) ;
277+ } ,
278+ ) ;
279+ } ) ;
280+ } ) ;
251281 chrome . tabs . sendMessage ( tabId , msg ) ;
252282 return true ; // attempt to fix message port closing error, consider return Promise
253283
0 commit comments