我正在尝试测试我们构建的具有临时ssl证书的网页,问题是当我转到页面时,我得到IE安全警告,证明ssl证书无效,有两个链接用于关闭页面,以及另一个进入页面.我能够使用power

shell打开IE并单击ssl警告页面上的链接,但现在我需要填充用户名和密码输入框,然后单击登录按钮.

$url = "res://ieframe.dll/invalidcert.htm?SSLError=50331648#https://10.2.2.1:8050/showme.do"

$ie = New-Object -comobject InternetExplorer.Application

$ie.visible = $true

$ie.silent = $true

$ie.Navigate( $url )

while( $ie.busy){Start-Sleep 1}

$secLink = $ie.Document.getElementsByTagName('A') | Where-Object {$_.innerText - eq 'Continue to this website (not recommended).'}

$secLink.click()

$ie.Document.getElementsByType("input") | where { $.Name -eq "j_username" }.value = "user"

$ie.Document.getElementsByName("input") | where { $.Name -eq "j_password" }.value = "password"

$loginBtn = $ie.Document.getElementsById('input') | Where-Object {$_.Type -eq 'button' -and $_.Value -eq 'LoginButton'}

$loginBtn.click()

所以现在页面打开但输入字段没有填充或单击按钮,我需要某种循环或while语句吗?

谢谢

更多推荐