title: Selenium code to open facebook messenger and send a message
body: <p>I'm just starting to learn a little bit of Selenium scripting (in Java). Currently I'm trying to open a chat box in Facebook and send a message.<br>
  I have gotten up to being able to open the chat box through selenium, however I can't figure out how to actually type things into the text box.<br>
  Currently here is my code:</p>
  
  <pre><code>import org.openqa.selenium.*;
  import org.openqa.selenium.chrome.ChromeDriver;
  
  public class practice {
      public static void main(String[] args) throws InterruptedException {
        System.setProperty("webdriver.chrome.driver", "C:/max/chromedriver.exe");
  
        WebDriver driver = new ChromeDriver();
        driver.get("http://facebook.com/login/");
        driver.manage().window().maximize();
        driver.findElement(By.name("email")).sendKeys("myemail@yahoo.com");
        driver.findElement(By.name("pass")).sendKeys("myPassword");
        driver.findElement(By.id("loginbutton")).click();
        driver.findElement(By.name("mercurymessages")).click();
        driver.findElement(By.cssSelector("a[href*='https://www.facebook.com/messages/conversation-8148306']")).click();
       // This has worked randomly. Sometimes the driver will work and open the chat box. Sometimes it will say element not found. I didn't include the full link of the conversation because apparently you don't have to. And it has worked like this in the past.
  }
  }
  </code></pre>
  
  <p>My current issue I'd like resolved is: why does this only work sometimes, and how do i find the text box area on the chat box? I did an Inspect Element and the chat box is very odd. It doesn't have anything like an id or a name, so i can't do By.id, or By.name. I can't figure out how to do it with By.cssSelector. This is what the inspect element for the text box looks like:</p>
  
  <pre><code>textarea class="uiTextareaAutogrow _552m" data-ft=".... more stuff here" onkeydown=" more stuff here" style= "more stuff here."
  </code></pre>