Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applescript 踩坑经验 #330

Open
xxleyi opened this issue Feb 26, 2022 · 0 comments
Open

applescript 踩坑经验 #330

xxleyi opened this issue Feb 26, 2022 · 0 comments

Comments

@xxleyi
Copy link
Owner

xxleyi commented Feb 26, 2022

  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
  1. 点击浏览器扩展以及扩展内部按钮
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant