Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created April 29, 2021 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subtleGradient/1195757cc9e84f06f076a8d3d4fcc5c7 to your computer and use it in GitHub Desktop.
Save subtleGradient/1195757cc9e84f06f076a8d3d4fcc5c7 to your computer and use it in GitHub Desktop.
Safari iOS Debug.jxa.js
#!/usr/bin/env osascript -l JavaScript
// macOS JXA JavaScript for Automation
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function run(argv) {
Application('Safari').activate();
const { Safari } = Application('System Events').applicationProcesses;
const { Develop } = Safari.menuBars[0].menuBarItems;
const Debugables = Develop.menus[0].menuItems
.whose({ name: { _beginsWith: 'Simulator ' } })[0]
.menus[0].menuItems();
[].slice.call(Debugables, 0, -3)
.map(it => it.click());
Develop.click(); // This shouldn't be necessary, but… it is anyway 🤷‍
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment