Accessibility Inspector: Provide a scripting dictionary or CLI

Originator:leopic
Number:rdar://FB7692850 Date Originated:05/07/2020
Status:Open Resolved:
Product:Xcode Product Version:Version 11.4.1 (11E503a)
Classification:Suggestion Reproducible:
 
I was trying to automate the Audit Report process in some way and the only way I could (sort of) get it to work was using AppleScript, but the script is brittle and prone to break with the slightest UI change or a different locale, here is my proof of concept:

```applescript
tell application "Finder"
	set app_location to alias "Macintosh HD:Applications:Xcode.app:Contents:Applications:Accessibility Inspector.app"
	open file app_location
	
	activate application "Accessibility Inspector"
	tell application "System Events"
		tell process "Accessibility Inspector"
			set frontmost to true
			click pop up button 1 of list 1 of group 1 of toolbar 1 of window "Accessibility Inspector"
			keystroke "Simulator"
			keystroke return
			delay 0.5
			
			click menu item "Enable Point to Inspect" of menu 1 of menu bar item "Inspection" of menu bar 1
			delay 0.5
		end tell
	end tell
end tell

tell application "System Events"
	tell process "Simulator"
		set frontmost to true
		select group 2 of group 1 of window 1
	end tell
end tell

tell application "System Events"
	tell process "Accessibility Inspector"
		set frontmost to true
		click button 2 of group 1 of group 3 of toolbar 1 of window 1
		
		click menu item "Run Audit" of menu 1 of menu bar item "Inspection" of menu bar 1
		delay 2.0
		
		click menu item "Save Audit Report As..." of menu 1 of menu bar item "File" of menu bar 1
		delay 2.5
		click button "Save" of sheet 1 of window "Accessibility Inspector"
	end tell
end tell
```

This was probably painful to read too, I'm sorry.

Providing a Scripting Dictionary or a CLI, similar to `simctl` would greatly help automate the process.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!