title: Using Python & Selenium to send message to friend in Facebook
body: <p>I am currently writing a script in Python to log in on facebook and I want to send message to a friend. The script logs in to my facebook, and it manages to find my friend, but the message is not sent. I'm not 100% sure, but I think the problem is in the div tag/CSS on the text area (I commented out that piece of code).</p>
  
  <p>Screenshot:
  <a href="https://i.stack.imgur.com/it9bZ.png" rel="nofollow noreferrer">Text doesn't appear here</a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  
  driver = webdriver.Chrome('C:\path\chromedriver.exe')
  driver.get('https://www.facebook.com/')
  
  username_box = driver.find_element_by_id('email')
  username_box.send_keys(USEREMAIL)
  passElem = driver.find_element_by_id("pass")
  passElem.send_keys(USERPASSWORD)
  passElem.send_keys(Keys.RETURN)
  userTargetUrl = "https://www.facebook.com/messages/t/" + "USERTAGET"
  driver.get(userTargetUrl)
  
  //The problem is here I think
      elem = driver.find_element_by_css_selector("div textarea.uiTextareaNoResize")
  
  
      while True:
          elem.send_keys("Test")
          elem.send_keys(Keys.RETURN)
          driver.find_element_by_id("u_0_t").click()
  </code></pre>
  
  <p>The error code i get is: </p>
  
  <pre><code>selenium.common.exceptions.NoSuchElementException: 
  Message: no such element: Unable to locate element: 
  {"method":"css selector","selector":"div textarea.uiTextareaNoResize"}
    (Session info: chrome=63.0.3239.132)
    (Driver info: chromedriver=2.35.528161 
  (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.15063 x86_64)
  </code></pre>