title: How do I interact with an Iframe using Powershell?
body: <p>I'm trying to automate a website and find myself needing to get to the contents of an iframe. Since this is an internal application, I've put in this sample, which illustrates the error</p>
  
  <pre><code>$ie = new-object -com "InternetExplorer.Application" 
  $ie.navigate("http://arstechnica.com/") 
  
  $ie.visible = $true 
  $doc = $ie.document 
  $maglistcontrol = $doc.getElementById("mag_list") 
  $maglistcontrol.value= "Concierge"
  </code></pre>
  
  <p>Here is the Error message I get</p>
  
  <pre><code>You cannot call a method on a null-valued expression.
  At line:6 char:38
  + $maglistcontrol = $doc.getElementById &lt;&lt;&lt;&lt; ("mag_list") 
      + CategoryInfo          : InvalidOperation: (getElementById:String) [], RuntimeExce 
     ption
      + FullyQualifiedErrorId : InvokeMethodOnNull
  
  Property 'value' cannot be found on this object; make sure it exists and is settable.
  At line:7 char:17
  + $maglistcontrol. &lt;&lt;&lt;&lt; value= "Concierge"
      + CategoryInfo          : InvalidOperation: (value:String) [], RuntimeException
      + FullyQualifiedErrorId : PropertyNotFound
  </code></pre>
  
  <p>The problem is, the mag_list field is in an iframe and the reference is not valid. Any ideas?</p>