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
$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"
Here is the Error message I get
You cannot call a method on a null-valued expression.
At line:6 char:38
+ $maglistcontrol = $doc.getElementById <<<< ("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. <<<< value= "Concierge"
+ CategoryInfo : InvalidOperation: (value:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The problem is, the mag_list field is in an iframe and the reference is not valid. Any ideas?