I'm using Safari's remote debugging to inspect a webview in an iPhone app in my simulator. The problem is that the remote debugging window closes as soon as the app does.
I have an action which switches to another app and back but I can't read console.log messages from immediately before the switch because I'm not quick enough and I can't read logs from immediately after coming back to my app because I have to re-open the console first.
Is there a way to keep it open so I can at least see the last logs from before switching apps?
Here is an AppleScript that launches Safari Inspector. You can export it as an executable application and have it sitting in your dock to get into Inspector with a single click or launch it in a build phase in Xcode.
tell application "Safari"
activate
delay 2
tell application "System Events"
tell process "Safari"
set frontmost to true
click menu item 2 of menu 1 of menu item "iPad Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
end tell
end tell
end tell
This is James' answer wrapped in an Alfred Workflow, -g- ... check it
ALSO WORKS FOR IPHONE BRAH
on alfred_script(q)
tell application "Safari"
activate
delay 0.5
tell application "System Events"
tell process "Safari"
set frontmost to true
try
click menu item 2 of menu 1 of menu item "iPhone Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
end try
try
click menu item 2 of menu 1 of menu item "iPad Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
end try
end tell
end tell
end tell
end alfred_script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With