我成功地使用了網絡自動化的腳本從這個網站: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