I have been beating my head in the wall all evening on this, can someone give me some idea how I can get WatiN to TypeText into this text box? It is disabled until a radio button is selected and I am at a loss.. I am still a bit new to all of this to go easy on me
<TR>
<TD WIDTH="100">Billing ID</TD>
<TD nowrap>
<INPUT TYPE="radio" NAME="reg_type" VALUE="Biller" ONCLICK="disableSubmitter(); clearAll(); document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.vendor_ID.disabled=false;">
<B>Vendor ID:</B>
</TD>
<TD WIDTH="100"><INPUT TYPE="textbox" SIZE="10" NAME="vendor_I开发者_如何学GoD" ID="vendor_ID" DISABLED ONBLUR='setupAjax();' value=""></TD>
</TR>
<TR>
<TD>Submitter ID</TD>
<TD nowrap>
<INPUT TYPE="radio" NAME="reg_type" VALUE="Submitter" ONCLICK="disableBiller(); clearAll(); document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.existing_Billing_ID.disabled=false;">
<B>Billing ID:</B>
</TD>
<TD WIDTH="100">
<INPUT TYPE="textbox" SIZE="10" NAME="existing_Billing_ID" ID="existing_Billing_ID" DISABLED ONBLUR='setupAjax();' value=""></TD>
<TD><INPUT TYPE="hidden" NAME="ff_option" VALUE="N"></TD>
</TR>
Here is the JavaScript for the onblur command to enable the textbox
function setupAjax()
{
var sendStr = "";
if(document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.reg_type[1].checked && document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.vendor_ID.value.length > 0)
{
document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.existing_Billing_ID.value = "";
sendStr += 'reset=false&vendor_ID=' + document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.vendor_ID.value;
sendStr += '&existing_Billing_ID=';
}
else if (document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.reg_type[2].checked && document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.existing_Billing_ID.value.length > 0)
{
document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.vendor_ID.value = "";
sendStr += 'reset=false&existing_Billing_ID=' + document.config_frmV_f5a46cc226670cb3a4d7e0f5a98703a0.existing_Billing_ID.value;
sendStr += '&vendor_ID=';
}
else
{
return;
}
I have tried to select by Id, Name, Index, you name it and I still cannot populate it despite the fact I can touch every other element on the page.. I am able to find it using the Element and it will report back the name however I cannot figure out how to populate the box using Elements
Figured a work around out for the problem by using JavaScript, working like a charm now!
StringBuilder js = new StringBuilder();
js.Append(@"var myTextField = document.getElementById('vendor_ID');");
js.Append(@"myTextField.setAttribute('value', '201153');");
ie.RunScript(js.ToString());
Question: Are you trying to enter a value in the textfield while it is disabled?
You won't (or at least shouldn't) be able to do something like mybrowser.TextField("myFieldID").TypeText("words go here") until the TextField is enabled.
Pseudocode
- Click the radio button
- Wait for the textfield to become enabled
- Type text in the textfield
精彩评论