有人可以在PowerShell知道为什么我不能找到用户名输入字段使用其ID“user_name”?我曾在其他网站上尝试过这方面的内容,但它一直在努力,但对于这一点,它只是拒绝找到它。我也尝试了IHTMLDocument3_getElementsByName方法和IHTMLDocument3_getElementsByTagName寻找诸如“输入”甚至“div”之类的东西。一些div类弹出,但有很多错过了,我不知道为什么它失踪。请给我看看灯光。Powershell IE登录自动化无法找到元素ID
#ID names
$IDuserName = "user_name"
$IDuserPass = "user_password"
$url = "https://isssupport.service-now.com/"
$ie = New-Object -com InternetExplorer.Application
$ie.visible = $true
$ie.navigate($URL)
While ($IE.Busy -eq $true) {Start-Sleep -Milliseconds 1000}
$ie.Document.IHTMLDocument3_getElementByID($IDuserName).Value = $userName
下面是用户名输入字段
<input name="user_name" id="user_name" type="text" class="form-control" value="" autocomplete="off">
'$ ie.Document.getElementByID($ IDuserName).value的= $ userName'通常为我工作。 –