Hello, I am trying to manipulate Facebook pages in various ways, which is tricky since there’s little or no support for this sort of thing from Facebook. I’m trying to do GUI scripting to simulate what I would type into the Facebook site itself. It’s tricky, since Facebook is so “Ajax-ey” and doesn’t use any of the old Put or Get forms which can be scripted somewhat through Javascrpt. The main challenge I’m having is reliably pressing the “submit” button to make wall posts on Facebook, after my script has entered some data that I want it to type. The only success I’ve had with this at all is using Automator to record an action to click “Submit” for me, but it fails 50% of the time for no reason that I can see.
So my question is, is there a “modern” way of scripting GUI (I presume) directly so that, say, the first button that says “submit” can be clicked reliably? Or if there’s a better way of doing this any suggestions would be great, too.
A way to click into the top text field (which contains the text “Type something…”) on a Facebook “wall” would be good too, although I am faking it by typing the tab key through GUI scripting.
Model: Macbook Pro
Browser: Safari 534.13
Operating System: Mac OS X (10.6)
Though I never do any web/Safari driving stuff, as a user it seems like FB tweaks their pages often enough I would never want to rely on the page to do any of that stuff.
Don’t they have some kind of API to communicate directly with their site? Maybe there’s some Objective C you could use.
How about Sikuli and Applescript?
I actually got it to work, using the program UI Browser, which lets you mouse over an object, and it tells you what the path is to the object, and even builds beginning scripts for you. Fabulous app, I recommend it. What I ended up with, to click the Share button in Facebook, was as follows:
tell application "System Events"
tell process "Safari"
click button "Share" of group 1 of group 2 of list 3 of group 9 of UI element 1 of scroll area 1 of group 3 of window thename -- this one works on the mini?
click button "Share" of group 1 of group 2 of list 3 of group 9 of UI element 1 of scroll area 1 of group 2 of window thename -- did not work
(the same page reported different UI locations on two different computers, which is why I put both in, in case it changed on me sometime).
So far it’s been quite reliable.