I am trying to explore the DOM structure of a HTML document. For this purpose I am writing a script in Powershell.
First approach:
$ie.Document.getElementsByTagName('*') | foreach {
$_.TagName
}
works fine. Now I want to explore more in depth. Therefore I wrote a function:
Function AnalyseTree
{
Param ([string]$TreeElement)
write "Called"
$TreeElement.TagName
}
$ie.Document.getElementsByTagName('*') | foreach {
AnalyseTree($_)
}
this one does nothing, it prints "called", but not any more the Tagname. When I say only $TreeElement I get DomObject. I can make however the situation worse, when I define different the function, that it say not even DomObject when I write $TreeElement only.
Function AnalyseTree
{
$TreeElement = $args[1]
write "Called"
$TreeElement.TagName
}
What I am doing so wrong ?
Thank you very much for every hint
and maybe, someone already wrote a function which does what I am trying to do ?
Thx a lot
Eryk