title: How to get all input elements in a form with HtmlAgilityPack without getting a null reference error
body: <p>Example HTML:</p>
  
  <pre><code> &lt;html&gt;&lt;body&gt;
       &lt;form id="form1"&gt;
         &lt;input name="foo1" value="bar1" /&gt;
         &lt;!-- Other elements --&gt;
       &lt;/form&gt;
       &lt;form id="form2"&gt;
         &lt;input name="foo2" value="bar2" /&gt;
         &lt;!-- Other elements --&gt;
       &lt;/form&gt;   
   &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Test code:</p>
  
  <pre><code>HtmlDocument doc = new HtmlDocument();
  doc.Load(@"D:\test.html");
  foreach (HtmlNode node in doc.GetElementbyId("form2").SelectNodes(".//input"))
  {
      Console.WriteLine(node.Attributes["value"].Value);            
  }
  </code></pre>
  
  <p>The statement <code>doc.GetElementbyId("form2").SelectNodes(".//input")</code> gives me a null reference. </p>
  
  <p>Anything I did wrong? thanks.</p>