How to click button with applescript using UI Element Inspector

Solution 1:

This is the easiest way...

tell application "Safari"
    if not (exists document 1) then reopen
    activate
    set URL of document 1 to "https://itunes.apple.com/us/app/ibooks/id364709193"
    delay 3
    do JavaScript "document.getElementsByClassName('lockup product application')[0].childNodes[3].onclick()" in document 1
end tell