Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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