tell application "Google Chrome"
activate
delay 0.3
end tell
tell application "System Events"
tell front window of (first application process whose frontmost is true)
set uiElems to entire contents
end tell
end tell
2. 点击浏览器扩展以及扩展内部按钮
tell application "Google Chrome"
activate
delay 0.3
end tell
set buttonName to "extension name
Has access to this site"
clickExtension(buttonName)
on clickExtension(buttonName)
tell application "System Events"
tell process "Google Chrome"
set HUOSHAN to pop up button buttonName of toolbar 1 of group 1 of window 1
tell HUOSHAN
perform action "AXPress"
end tell
end tell
end tell
end clickExtension
delay 2
tell application "System Events"
-- 略丑,但能工作
set SYSIT to static text "SY-SIT" of group 1 of group 1 of group 7 of group 1 of group 1 of group 1 of group 2 of group 2 of group 1 of group 1 of UI element 1 of group 1 of window 1 of application process "Google Chrome" of application "System Events"
tell SYSIT
-- click
perform action "AXPress"
end tell
end tell
tell application "System Events" tell front window of (first application process whose frontmost is true) set uiElems to entire contents end tell end tell
tell application "Google Chrome" activate delay 0.3 end tell
set buttonName to "extension name Has access to this site" clickExtension(buttonName)
on clickExtension(buttonName) tell application "System Events" tell process "Google Chrome" set HUOSHAN to pop up button buttonName of toolbar 1 of group 1 of window 1 tell HUOSHAN perform action "AXPress" end tell end tell end tell end clickExtension
delay 2
tell application "System Events" -- 略丑,但能工作 set SYSIT to static text "SY-SIT" of group 1 of group 1 of group 7 of group 1 of group 1 of group 1 of group 2 of group 2 of group 1 of group 1 of UI element 1 of group 1 of window 1 of application process "Google Chrome" of application "System Events" tell SYSIT -- click perform action "AXPress" end tell end tell