how to post in facebook using selenium webdriver and python
Question: I writen this code to post in facebook group from desktop program but it
didnnot work. I'm using python and selenium webdriver in this script.

Can someone help me?

    
    
    from selenium import webdriver
    
    from selenium.webdriver.support.ui import webDriverWait 
    
    import unittest
    
    class post(unittest.Testcase):
    
        def setUp(self):
                self.driver = webdriver.Firefox
                self.driver.get("https://www.facebook.com/<grouplink>")
    
        def test_shar(self):
            driver = self.driver
            grouppost  = "test"
            textid     = "xhpc_message_text"
            buttonid   = ".//*[@id='u_jsonp_25_s']/div/div[5]/div/ul/li[2]/button"
            fblogopath = "(//a[contains(@href, 'logo')])[1]"
    
            textfiledelemnt = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_id(textid))
            sharebotton     = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(buttonid)
    
            textfiledelemnt.clear()
            textfiledelemnt.send_keys(grouppost)
            buttonid.click()
            WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(fblogopath)
    
        def tearDown(self):
                self.driver.quit()
    
    if __name__ == '__main':
        unittest.main()
    


Answer: I would suggest you not to rely to WebDriver for purpose such as one you
mention.

Use [Graph API](https://developers.facebook.com/docs/graph-api), here are two
good examples:

1) [How do I update FB Status using Python &
GraphAPI](http://stackoverflow.com/questions/13372528/how-do-i-update-fb-
status-using-python-graphapi)

2) [Posting to Facebook
wall](http://stackoverflow.com/questions/16668498/posting-to-facebook-wall)

