I'm downloading website with such command:
$response = Invoke-WebRequest 'http://stackoverflow.com'
Is it possible to use querySelector or querySelectorAll to find certain elements? I know I can use $response.ParsedHtml.all
and filter those, but I want to use more sophisticated query and I don't see anything in $response.ParsedHtml.documentElement
.
I'm using powershell 3 RC.
I use the method getElementsByTagName. I'm not sure if that will work for you. Here's how I get the images from the page, using your code above:
$response.ParsedHtml.getElementsByTagName("img")
Other methods exist for class name or ID. Use $response.ParsedHtml | gm -MemberType Method
for more options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With