How can we use facebook api to post on friends' timeline, upload photos dynamically?

how can we use facebook api to post on friends’ timeline, upload photos dynamically? is there any other way of doing that. did try using the web but having a problem dynamically as its not selecting create api on different profile. means it is opening to browser, logging in, going to the profile, posting, navigating to other profile then crashing because of not getting the ui selector. please help