gpt4 book ai didi

javascript - Powershell 找不到元素

转载 作者:行者123 更新时间:2023-11-30 06:52:47 25 4
gpt4 key购买 nike

我正在尝试登录,然后导航到一个页面,然后在第二个页面上设置元素值并提交它们。但是powershell一直说元素不存在。因此,为了排除故障,我想将我所在页面的内容写入文本文件。以下脚本创建一个空白文件。有任何想法吗?

$ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate($URL)


while ($ie.Busy -eq $true)
{
Start-Sleep -Milliseconds 1000;
}
$ie.Document.getElementById("userId").value = $username
$ie.Document.getElementByID("userPassword").value=$password
$ie.Document.getElementById("login").Click();
while ($ie.Busy -eq $true) { Start-Sleep -Seconds 1; }


Start-Sleep -Milliseconds 10000;


#$ie.Document.getElementById("officeList").action ="edit.jsp";
#$ie.Document.getElementById("officeId").value="1234";
#$ie.Document.getElementById("officeList").submit();
$ie.navigate($URL2)
$ie.document.documentelement.innertext |out-file C:\Users\me\Documents\PowerShell\html.txt

最佳答案

您确定您的元素名为 userId 和 userPassword 等吗?您可以在浏览器中按 F12 来检查它们

关于javascript - Powershell 找不到元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32400910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com