xxleyi / learning_list

聚集自己的学习笔记
10 stars 3 forks source link

applescript 踩坑经验 #330

Open xxleyi opened 2 years ago

xxleyi commented 2 years ago
  1. 查看页面元素,有时候会失败,需要耐心尝试
    
    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