本文介绍了使用Powershell来检查IE11中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我正在使用Powershell搜索基于HTML的数据库。
带有复选框的HTML:
So I am using powershell to search a database that is based in HTML. The HTML with the checkbox is:
INPUT name=extend id=perextend onchange=javascript:disabledPagination(); type=checkbox value=on
现在我已经搜索并尝试了其他选项,但仍然没有运气:
Now i have search and tried different options, but still no luck:
$chk = $ie.Document.getElementsByTagName("extend") | where-object {$_.type -eq "checkbox"}
$chk.Checked = $True
但是它给我一个错误:
+ $chk.Checked = $True
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
任何帮助都会很棒。抱歉,如果遇到常见错误,我是PowerShell的新手。
Any help would be great. And sorry I am new to powershell if its a common mistake
推荐答案
似乎我在给它分配了错误的元素并查看了调试器:
It seems that i was assigning it the wrong element and looking at debugger:
<td width="230"><input type="checkbox" name="extend" value="on" onchange="javascript:disabledPagination();" id="orgextend">
然后使用ID和.Checked = $ true解决了我的问题:
Then using the ID and .Checked = $true has solved my issue:
$chk = $ie.Document.getElementById("orgextend").Checked = $true
这篇关于使用Powershell来检查IE11中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!