title: C# How to get method and selector from NoSuchElementException
body: <p>I'm using C#.NET 4 and Selenium WebDriver 2.44.0.0 and chromeDriver.
  When it cannot find element, Selenium throws error:</p>
  
  <pre><code>no such element
  (Session info: chrome=38.0.2125.104)
  (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64)
  </code></pre>
  
  <p><br/>
  <strong>But I would like to know which element is missing</strong>. I see some articles said that it can show details like this:</p>
  
  <pre><code>OpenQA.Selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"hello"}
  </code></pre>
  
  <p><br/>
  Could anyone tell me how to get the method and selector from NoSuchElementException?</p>
  
  <p><br/>
  Here is my code</p>
  
  <pre><code>try
  {
       for(int i=0; i&lt;10; i++)
       {
            string className = "items-" + i;
            IWebElement t = Driver.FindElement(By.CssSelector("[class$='" + className + "'] &gt; span"));
            t.Click();
       }
  }
  catch (NoSuchElementException ex)
  {
       Logger.Error("Error: " + ex.Message);
       Debug.WriteLine(ex.Message);
  }
  </code></pre>