Hi,
I want to parse local HTML files.
Is there another way than using the Internet Explorer($ie = new-object -com "InternetExplorer.Application";) (without relaying on external packages)?
At the moment I do something like that:
$ie = new-object -com "InternetExplorer.Application"; Start-Sleep -Seconds 1 $ie.Navigate($srcFile) Start-Sleep -Seconds 1 $ParsedHtml = $ie.Document foreach($child in $ParsedHtml.body.getElementsByTagName('table')) { ...
I still want to have the methods like 'getElementById()' or 'getElementByTagName()'.
With my current approache, the performance is not realy good and it seems that the iexplorer.exe process is not terminating at the end of the script.
Also it seems to have sideeffects with running internet explorer instances (from GUI) - not working to start IE in powershell sometimes.
Last time I also have a hanging script, not continuing till i manually terminate the iexplorer.exe process.
The error was:
Exception calling "Navigate" with "1" argument(s): "The remote procedure call f ailed. (Exception from HRESULT: 0x800706BE)" At D:\Scripts\Run.ps1:529 char:14+ $ie.Navigate <<<< ($src)+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : ComMethodTargetInvocation
so I would prefere a method parsing HTML without IE.