I am testing a link inside a website. The link will pop up a window. Once this happen the script will not respond - It is not freezing but will not respond.
It is kind of waiting for something!
DealerPortalInternetSite = "Website"
$ie = New-Object -ComObject InternetExplorer.Application
$ie.visible=$true
$ie.Navigate($DealerPortalInternetSite)
while($ie.busy -or $ie.ReadyState -ne 4) {
start-sleep 1
}
$ie.document.IHTMLDocument3_getElementById("txtUserID").value = "Username"
$ie.document.IHTMLDocument3_getElementById("txtPassword").value ="Passwor"
while($ie.busy -or $ie.ReadyState -ne 4) {
start-sleep 1
}
$ie.Document.IHTMLDocument3_getElementById("btnLogin").click()
while($ie.busy -or $ie.ReadyState -ne 4) {
start-sleep 1
}
if ($ie.LocationURL -eq "WebsiteLocation"){
Write-Host "Log in to Dealer Portal is successful `n" -ForegroundColor Cyan
} else {
Write-Host "Log in to Dealer Portal has failed `n" -ForegroundColor Red
}
while($ie.busy -or $ie.ReadyState -ne 4) {
start-sleep -Seconds 1
}
$fs2 = $ie.Document.IHTMLDocument3_getElementById("fs2")
$menuFrame = $fs2.document.IHTMLDocument3_getElementById("oMenuFrame")
$bos01 = $menuFrame.contentWindow.document.IHTMLDocument3_getElementById("bos01")
$bosLink = $bos01.getElementsByTagName("a").item()
$bosLink.click()
The script is waiting for
$bosLink.click()
the window will pop up but then you have to close it manually for the script to continue.
how can I close the popup window and return to the parent window and make script continue.