title: how to post in facebook using selenium webdriver and python
body: <p>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.</p>
  
  <p>Can someone help me?</p>
  
  <pre><code>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/&lt;grouplink&gt;")
  
      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()
  </code></pre>