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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -