私は、オプションが選択されるまでアクティブにならないボタンを持つウェブサイトを持っています。しかし、私はオプションを選択し、物理的にクリックしない限り、ボタンはまだアクティブにならない。私は、PowerShellスクリプトにsend-key vbスタイルを使用することを考えていましたが、フォーカスの問題のために推奨されていないと聞いていました。 [System.Windows.Forms.SendKeys]::SendWait(“{ENTER}”)
Powershell Webオートメーション
これは私が試したことであり、私にとってはうまくいきませんでした。 (私はリストのオプションを変更することができますが、グレー表示されているのでボタンをクリックすることはできません)。私はxml 1.0のいくつかのタイプを使用して参照してください、または何かを行うことができる"Go_NextPage(document.FORM.Class)"
。
のPowershell:
$ie = New-Object -ComObject "InternetExplorer.Application"
$ie.navigate("http://website/address")
$ie.visible =$true
While ($ie.busy -eq $true){
[System.Threading.Thread]::Sleep(1000)
}
$doc = $ie.document
$type = $doc.getElementById("class")
#$type.click() << was seeing if i could click it even though its not a button.
$type.value = "7"
$bt = $doc.getElementsByTagName("input") |
Where-Object {$_.Name -eq "Class_Button"}
$bt.click() # but is grayed out
HTMLのCODE:以下
<td>
<select name="Class" id="Class" size="1">
<script language="JavaScript" type="text/javascript">
//<![CDATA[
AdrTypeList();
//]]>
</script>
<option value="2">Some </option>
<option value="3">Thing </option>
<option value="7">File
</option></select>
<input type="button" class="ButtonEnable" name="Class_Button"
id="Class_Button" value="Set " onclick="Go_NextPage(document.FORM.Class)">
</td>