windows - IE Automation with Powershell -
i attempting automate login website on our intranet using powershell , ie. far, have following code works:
$ie = new-object -com "internetexplorer.application" $ie.navigate("https://somepage/jsp/module/login.jsp/") while($ie.readystate -ne 4) {start-sleep 1} $ie.visible = $true $doc = $ie.document if ($doc.nameprop -eq "certificate error: navigation blocked") { $doc.getelementbyid("overridelink").click() } $loginid = $doc.getelementbyid("loginid") $loginid.value= "username" $password = $doc.getelementbyid("password") $password.value = 'somepass' $ie.navigate("javascript:dosubmit('login')",$null,$true)
so, problem area have site closes original window used login , opens new ie window. how go submitting inputs new window? know can use tasklist.exe /v pid of new window... i'm not sure how go taking control of it.
also, after viewing code, please know not intend use embedded user name , passwords. that's in place don't have continually type un/pw combo every time want test script.
after trying bit more...
$applist = new-object -com shell.application $newie = $applist.windows() | {$_.type -eq "html document" -and $_.locationurl -match "mainframe.jsp"}
Comments
Post a Comment