System.__ComObject String Representation
i have noob question. have variable of type system.__comobject, , want try string representation of debugging purposes. when print variable, "system.__comobject" displayed.
for context, have basic html page looks this:
<html>
<body>
<table>
<tr>
<th>...</th>
</tr>
<tr>
<td><a href...>...</a></td>
</tr>
...
</table>
</body>
</html>
and trying drill down href links in table. have code:
$webclient = new-object system.net.webclient
$webclient.usedefaultcredentials=$true
$geturl = invoke-webrequest $url
$webpage = $geturl.parsedhtml.body
$list = $webpage.table#.tr
echo "list: $webpage"
if($list -eq $null) {
echo "list null"
} else {
echo "list not null"
}
where $list null reason. attempting determine $webpage contains can figure out why can't find table tag.
any appreciated.
hi aussiemcgr,
we can view available methods via "$webpage|get-member" before use method.
if there tables inside webpage, please try use script below:
@($geturl.parsedhtml.getelementsbytagname("table"))[0].outerhtml
for more detailed information script, please check article:
importing website tables excel
if there else regarding issue, please feel free post back.
best regards,
anna wang
Windows Server > Windows PowerShell
Comments
Post a Comment