I would like to retrieve the scrollArea size and position of Google Chrome using AppleScript (JXA). (my goal is to get the client area size).
I am unable to find the corresponding UIElement inside the hierarchy.
Here is the JXA code:
function inspect(obj, depth) {
var indent = "".padStart(3*depth)
for (var i in obj) {
if(obj[i] instanceof Array) {
inspect(obj[i])
} else if(obj[i] instanceof Object){
console.log(`${indent}(${obj[i].position()}, ${obj[i].size()}) ${obj[i].class()}/${obj[i].role()}:: ${obj[i].name()}`)
inspect(obj[i].uiElements(), depth + 1)
}
}
}
var sysEv = Application('System Events')
var app = sysEv.processes['Google Chrome']
inspect(app.windows(), 0)
However, the macOS Accessibility Inspector can find it:
Any clues? Thanks for your help!