Using a c# web browser control, I am navigating a commercial website to access a list of potential jobs. However, I encountered an issue while trying to bid on these jobs through some links.
The problem arises when dealing with forms that contain two select elements (drop-down lists) where the options are dynamically generated by JavaScript scripts available in the page source code.
In the given form snippet below, you can observe that there are no options under the select elements initially:
<form name="frm1" id="frm1" action="/tab/Transport/LoadAssigned2.asp" method="post">
<table class="section">
<tr>
<td>Name</td>
<td>
<input type="text" name="s_name" id="s_name" size="25" maxlength="50"></td>
</tr>
<tr>
<td>Fax</td>
<td>
<input type="text" name="txtFaxNumber" id="txtFaxNumber" size="25" maxlength="15" value="1234567890"></td>
</tr>
<tr>
<td>Email</td>
<td>
<input type="text" name="txtEmail" id="txtEmail" size="25" maxlength="225"></td>
</tr>
<tr>
<td>Pickup will occur on or before</td>
<td>
<select name="stransp_pickup_date" id="stransp_pickup_date" style="width: 173px;" onchange="setDeliveryDate()">
</select>
</td>
<tr>
</tr>
<td>Delivery will occur on or before</td>
<td>
<select name="stransp_delivery_date" id="stransp_delivery_date" style="width: 173px;">
</select>
</td>
</tr>
</table>
<input type="hidden" name="nload_id" id="nload_id" value="123456789">
</form>
The script named "setDeliveryDate" dynamically populates the options based on the selected date from the first select element and the distance criteria provided.
Given the dynamic generation nature, the challenge lies in selecting specific date options from both lists despite not having them visible in the source code. The number of options displayed varies depending on the distance parameter as per the mentioned script.
If required, additional script details can be provided for further understanding. Any assistance or guidance on how to access these dynamically generated elements would be greatly appreciated.