|# Customize and Export as Application|
|set device_name to "My iPhone"|
|tell application "Safari"|
|tell application "System Events"|
|click menu item "index.html" of menu device_name of menu item device_name of menu "Develop" of menu bar item "Develop" of menu bar 1 of application process "Safari"|
Safari, or a PhoneGap application (or anything that has a webview, as long as you have a matching profile) needs to be open on the iPhone, and be a recent iOS version.
And having the web inspector enabled on the device: https://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/DebuggingSafarioniPhoneContent/DebuggingSafarioniPhoneContent.html