Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell IE Automation FireEvent未触发_Powershell_Internet Explorer 9 - Fatal编程技术网

Powershell IE Automation FireEvent未触发

Powershell IE Automation FireEvent未触发,powershell,internet-explorer-9,Powershell,Internet Explorer 9,这就是我的困境。这是代码的一部分: $ie.Document.getElementById("ctl00_ContentPlaceHolder1_ctl11_SSLControl_ddlIndustry").SelectedIndex = "6" $ie.Document.getElementById("ctl00_ContentPlaceHolder1_ctl11_SSLControl_ddlIndustry").FireEvent("onchange") 当我将其作为脚本的一部分运行时,不

这就是我的困境。这是代码的一部分:

$ie.Document.getElementById("ctl00_ContentPlaceHolder1_ctl11_SSLControl_ddlIndustry").SelectedIndex = "6"
$ie.Document.getElementById("ctl00_ContentPlaceHolder1_ctl11_SSLControl_ddlIndustry").FireEvent("onchange")
当我将其作为脚本的一部分运行时,不会触发FireEvent。我得到的返回值为True,但操作不起作用。如果手动复制并粘贴Powershell中的每一行,FireEvent将正常工作

我认为Powershell并不是在等待firevent完成触发,而是已经进入下一行

我的问题是,如何让powershell等待整个命令完成,或者等待其他选择

提前谢谢

是在浏览器忙时添加等待

while($ie.Busy) { Start-Sleep -Milliseconds 100 }

有不同的类型。你需要哪一个?这里的问题不是浏览器没有等待,而是powershell,它运行包含FireEvent的行,然后立即转到下一行。我在这里的问题是,如何告诉powershell在转到下一行脚本之前等待该命令完成。尽管这在脚本的另一部分上对我有所帮助!谢谢