title: In Powershell, is there a way to convert html to a object with depth?
body: <p>I was working with Powershell to experiment with webscraping and wondered if there was an easier way to deal with elements?</p>
  
  <p>Is there a way to convert an Html page to an object in powershell with proper depth? Something similar to Convert-ToJson -Depth?</p>
  
  <p>For example, to get a certain results:</p>
  
  <pre><code>$page = Invoke-WebRequest -uri $URI
  Write-Host $page.html.body.div[4].a[5]
  </code></pre>
  
  <p>or maybe</p>
  
  <pre><code>$page = Invoke-WebRequest -uri $URI
  $divs = $page.getElementsbyID("image-div")
  $thumbs = $ $divs.getElementsbyID("thumbnails")
  Write-host $thumbs[4]
  </code></pre>
  
  <p>Is there some add-on or feature already in Powershell to parse the html to an object with depth?</p>