This is my first Stack Overflow post!
Im trying to check if a website is fully loaded through Powershell. I discovered that the function Invoke-Request and Select-String is what I need to check for a word on the site (which only appears after the website is fully loaded). Then If the word is found, I want to give a value "true" for example back to break out of a loop. an example can be seen in Answer 1 on this Example solution
However, if I use this solution I'm getting as an output the entire HTML code. Which I don't want Does any 1 know how to avoid getting the entire HTML script? and how to return the word as a "true" value? As an example I want to return from this Website the sentence "No products found." to check if it was fully loaded.
This is a code example I currently have. The Try + Catch example would be an if else statement that could break me out of the loop after finding the sentence "No production found".
Do you guys have any idea how to solve this?
try {
$Response = Invoke-WebRequest -URI https://pwa-woo.wpmobilepack.com/#/;
write-Host $Response.InputFields | Where-Object
{
$_.name -like "* No products found.*"
}
#break out of the loop
write-Host "Case True and break the loop"
}catch {
write-Host "Case False dident work"
}
(The solution shouldn't create a file)