I have a website that has a button that does not become active until an option is selected. But I select an option and the button still wont become active, unless I physically click on it. I was thinking of using the send-key vb style to the powershell script, but heard its not recommended because of focus issues. [System.Windows.Forms.SendKeys]::SendWait(“{ENTER}”)
This is what i have tried and didnt work for me. ( I'm able to change the list options, but cant click the button because it's grayed out). i see its using some type of xml 1.0, could i do something with that, or "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>