Internet explorer InternetExplorer.Application:选择多个“选项值”字段

Internet explorer InternetExplorer.Application:选择多个“选项值”字段,internet-explorer,powershell,Internet Explorer,Powershell,尝试使用Powershell实现IE自动化。 任务:选择多个选项值字段并单击submitbutton HTML看起来像: 选择第1行是因为它是默认的 如何选择所有行 如何选择第2行?我想我自己找到了答案,除非有人有更好的方法: ($ie.document.getElementsByTagName("option") | where {$_.innerText -like "*Line 3*"}).IHTMLOptionElement_selected = $True 我想我自己找到了答案除非有

尝试使用Powershell实现IE自动化。 任务:选择多个选项值字段并单击submitbutton

HTML看起来像:

选择第1行是因为它是默认的

如何选择所有行


如何选择第2行?

我想我自己找到了答案,除非有人有更好的方法:

($ie.document.getElementsByTagName("option") | where {$_.innerText -like "*Line 3*"}).IHTMLOptionElement_selected = $True

我想我自己找到了答案除非有人有更好的方法:

($ie.document.getElementsByTagName("option") | where {$_.innerText -like "*Line 3*"}).IHTMLOptionElement_selected = $True
($ie.document.getElementsByTagName("option") | where {$_.innerText -like "*Line 3*"}).IHTMLOptionElement_selected = $True