Hello i'm trying to automate Facebook messages so i can send automatic message to a specific friend. The first thing i did is to connect to my account and everything works fine except when i try to locate a friend within the chat side bar .
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
namespace Automation
{
    class Program
    {
        static void Main(string[] args)
        {
            using (IWebDriver driver = new FirefoxDriver())
            {
                driver.Navigate().GoToUrl("https://facebook.com");
                IWebElement username = driver.FindElement(By.XPath(".//input[@id='email']"));
                username.SendKeys("username");
                IWebElement password = driver.FindElement(By.XPath(".//input[@id='pass']"));
                password.SendKeys("password");
                IWebElement submit = driver.FindElement(By.XPath(".//input[@id='u_0_l']"));
                submit.Submit();
                var wait = new WebDriverWait(driver,TimeSpan.FromSeconds(20));
                wait.Until(d => d.Title == "Facebook");
              // Problem goes here
                IWebElement friend = driver.FindElement(By.XPath(".//a[@href='/messages/id']"));
                friend.Click();
                var waitFriendLoad = new WebDriverWait(driver,TimeSpan.FromSeconds(10));
                waitFriendLoad.Until(d => d.Url == "https://facebook.com//messages/id");
            }
        }
    }
}
Everything works fine except when i try locate the friend using x-path. So, it throws Unable to locate element exception
 
    