我成功地使用了网络自动化的脚本从这个网站:heise web automationPowerShell中,IE9和的getElementById
我知道这是在德国,但也许有人可以提供帮助。
电子加网的重要组成部分:
<tr>
<td class="td1">Benutzername:</td>
<td class="space"><img src="/img/c.gif" alt="" /></td>
<td class="td2"><input type="text" id="IDToken1OL" name="IDToken1" onfocus="setToken(this)" onblur="getToken(this)" value="Benutzername" /></td>
</tr>
<tr>
<td class="td1">Passwort:</td>
<td class="space"><img src="/img/c.gif" alt="" /></td>
<td class="td2"><input type="password" id="IDToken2OL" name="IDToken2" onfocus="setToken(this)" onblur="getToken(this)" value="" class="passwortFake" /></td>
</tr>
PowerShell脚本的一部分:
$script:ie = New-Object -comobject InternetExplorer.Application
$ie.visible = $false
$ie.silent = $true
#
$ie.Navigate("https://www.eplus.de/login/login.asp")
LadenWarten(1)
#
$ie.Document.getElementById("IDToken1OL").value = $user
$ie.Document.getElementById("IDToken2OL").value = $passwort
$ie.Document.getElementsByTagName("a") | foreach {
if ($_.href -eq "javascript:SSO_Submit()") {
$_.Click()
}
}
中的getElementById工作了IE8,但我现在已经更新到IE9,这是不再工作了。
的errormessage的:
+ $ie.Document.getElementById <<<< ("IDToken1OL").value = $user
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
的参数的数量是错误的。
我所能找到的只是一个提示,即在ie9中getElementById发生了变化。
任何人都可以帮忙吗?
谢谢,大卫
很酷,谢谢你的帮助。我将该网站添加到兼容性视图的网站列表中 – David 2011-05-20 16:43:09