2

I am following the WWDC talk Javascript for automation. Following is an example from slide 99. I am getting an error on line 3 on new install of yosemite.

Safari = Application('Safari')
doc = Safari.document[0]
url = doc.url() // -> here
doc.url = 'http://apple.com'
Mosè Raguzzini
  • 15,399
  • 1
  • 31
  • 43
satyajit
  • 1,470
  • 3
  • 22
  • 43
  • In my case I was trying to access the properties directly rather than through getters. Use `Application('System Preferences').panes[0].id() ` – Sridhar Sarnobat Jun 02 '21 at 01:43

1 Answers1

3

The slide has a typo on it. The second line should be

doc = Safari.documents[0]
                     ^

With documents (plural) instead of document.

Ben Zotto
  • 70,108
  • 23
  • 141
  • 204