Posting to Own Facebook Page with Python

cole9595

Newbie
Joined
May 15, 2018
Messages
9
Reaction score
1
Good day,

I have a little background in other programming and decided to learn python. I figure the best way is to just jump ight in and build a script that does something I want.

Anyways, I have the script scrapping data from a source I want to post onto one of my facebook pages. Rather than me having to go out and gather the info myself and sharing it on the page I figure just let a script do it.

The script is working well for scrapping the data and I can log into facebook using chrome webdriver. I can navigate to my page but no matter what I try I can't seem to select the post box to type in the content. I tried the facebook API but it appears they've changed and I would require my script to be approved for the api to be public to allow me to use it. They no longer offer permanent access tokens either so that option is out.

I believe my only option is to continue using webdriver to control chrome to do what I need.

So my question is do anyone know what I would use (xpath, css selector) in order to select the text box to type my message on my facebook page? I've tried a few dozen different ways of trying to do this and all have failed saying it cannot find it. I even downloaded a chrome extension for generating relative xpaths and it still fails when I use them.

It's probably something simple I'm missing. Any help you can give it appreciated.
 

Attachments

  • 2018-05-13_2351.png
    2018-05-13_2351.png
    82.4 KB · Views: 231
The textbox field where you need to enter data is inside an iframe . So find all the iframe in the page, switch to the one with the textbox and select the textbox and use send_keys method to post content there .
 
It's an old thread so I don't think they need help anymore.

However in these situations I often try the mobile site, or disable JS, or change my useragent to an old Internet Explorer version. Facebook should have a different site for each of these scenarios and the likelihood is that the oldest one is the easiest to automate with.
 
Back
Top