title: "Object reference not set to an instance of an object" and HtmlAgility
body: <p>i have a problem that confused me !
  i want to <strong>scraping</strong> a value from a webpage.
  i found xpath with chrome and inspector
  <code>&quot;//*[@id='GlobalTab0Elm']/div[2]/div[1]/div[2]/table/tbody/tr[7]/td[2]/div&quot; </code></p>
  <p>when i use above xpath in webscraper in chrome (extension) it works fine.
  but the problem is this isnt work on my simple program that you can see this :</p>
  <pre><code>     Dim Handler As HtmlAgilityPack.HtmlWeb.PreRequestHandler = Function(request As HttpWebRequest)
                                                                         request.Headers(HttpRequestHeader.AcceptEncoding) = &quot;gzip, deflate&quot;
                                                                         request.AutomaticDecompression = DecompressionMethods.Deflate Or DecompressionMethods.GZip
                                                                         request.CookieContainer = New System.Net.CookieContainer()
                                                                         Return True
                                                                     End Function
          Dim webClient As HtmlWeb = New HtmlWeb()
          webClient.PreRequest = Handler
  
  
          webClient.UserAgent = &quot;Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5&quot;
          webClient.UseCookies = True
  
          Dim htmlDoc = webClient.Load(&quot;http://www.tsetmc.com/Loader.aspx?ParTree=15&quot;)
          htmlDoc.OptionReadEncoding = False
          Dim S As String
          S = &quot;//*[@id='GlobalTab0Elm']/div[2]/div[1]/div[2]/table/tbody/tr[7]/td[2]/div&quot;
          Dim node = htmlDoc.DocumentNode.SelectSingleNode(S)
      TextBox1.Text = (node.InnerText)
  </code></pre>
  <p>my qustion is why this xpath works on the other scraper but it didnt work on these code? what i have to do ?
  The err happen at this line :</p>
  <pre><code>TextBox1.Text = (node.InnerText)
  </code></pre>
  <p>and the error text is</p>
  <pre><code>Object reference not set to an instance of an object.
  </code></pre>
  <p>when i use this xpath</p>
  <pre><code>&quot;//*[@id='company_text']/text()[2]&quot;
  </code></pre>
  <p>it found the correct value of xpath.</p>
  <p>my problem is it doesnt work with this xpath.</p>
  <pre><code>&quot;//*[@id='GlobalTab0Elm']/div[2]/div[1]/div[2]/table/tbody/tr[7]/td[2]/div&quot;
  </code></pre>