【发布时间】:2019-04-01 04:49:04
【问题描述】:
我在选择复选框时遇到问题。我已经能够通过 ID 标签成功登录和导航,但是这个没有。它唯一的标签是类型和类。
我可以使用 $ie.document.IHTMLDocument3_getElementByTagName("input") 找到此部分,但我找不到任何使用它的方法。
这是我正在使用的 html:
<th class="cText sorting_disabled cHeader" rowspan="1" colspan="1" style="width: 5px;" aria-label="">
<input type="checkbox" class="selectall">
</th>
到目前为止我所拥有的:
$ie = New-Object -ComObject "InternetExplorer.Application"
$ie.visible = "true"
$ie.navigate("https://some.site.com")
while($ie.Busy) { Start-Sleep -Milliseconds 100 }
# login
$usernameField = $ie.document.IHTMLDocument3_getElementByID("userid")
$passwordField = $ie.document.IHTMLDocument3_getElementByID("Password")
$usernameField.value = "email@domain.com"
$passwordField.value = "supercoolpassword"
$btn_Submit = $ie.document.IHTMLDocument3_getElementByID("btn_signIn")
$btn_Submit.click()
# go to downloads page
$ie.navigate("https://some.site.com/pages/mydownloads.aspx")
# selectall packages to download has me clueless
当复选框被点击时,结果应该是所有的复选框都应该被勾选。
【问题讨论】:
标签: powershell internet-explorer