Monkey see, monkey do #

It turns out that GUI Scripting isn't quite the way to go. It relies on the accessibility APIs for its functionality. iTunes doesn't support them, beyond the menus and the scrollbars of the main window. I don't know whether this is intentional, or if this is just a remnant of iTunes' lineage as a Mac OS 9 app (presumably it doesn't use HIViews yet). In any case, GUI Scripting isn't completely useless, I can use the menu-bar to disconnect from shares when I'm done with them, and the scrollbars will allow me to move through the list of shares (though this is hard to test since I'm not on campus at the moment, so I have access to a grand total of two shared libraries). For the actual connection to each library, I am reduced to resizing the iTunes window to a known size and putting in a known location, and then programatically clicking in various places (using XTool for this). Seems to work pretty well so far, though I'm not sure how I'll handle password protected shares yet.

Also wrote a small CLI program to count how many iTunes shares there are out there (the alternative was to a screen capture and analyze it programatically or query the scrollbar (if any), but this seems less brittle). CFNetServices (the non-Cocoa way of getting at Rendezvous functionality) is pretty neat and easy to use.

P.S. The title is in reference to Apple's testing methodology for GUI software.

Post a Comment