Simple Applescript proving to be perplexing
I have a late 2008 Macbook Pro running Mavericks.
I am trying to write an Applescript that will go to Amazon using a predefined URL, and then click on the first search result. Afterwhich it would do other things like copying the item description, model, etc.
Since "Click at" is broken in Mavericks and I don't feel my MBP would run very well with Yosemite I am trying to work around this limitation.
I have tried a number of scripts I found online, with none of them working, I think perhaps because I am not supplying the correct information to the script.
Below is the URL. The script will be executed upon this page being displayed.
On that page I need it to click the first result's link, taking it to the details page...when I use "Inspect element" on the link I get the following:
I have tried scripts like this:
tell application "Safari"
activate
do JavaScript "document.getElementByClass('a-link-normal s-access-detail-page a-text-normal').click()" in document 1
end tell
Which results with:
And I also tried:
tell application "Safari"
activate
do JavaScript "document.getElementById('result_0').click()" in document 1
end tell
Which gives me:
What am I doing wrong? Any help would be greatly appreciated!
MacBook Pro (15-inch Late 2008), null