[Webtest] setSelectField with onclick event
Stefan Voß
webtest@lists.canoo.com
Wed, 10 Aug 2005 09:25:35 +0200
Hi everybody,
I'm having trouble with testing JavaScript features. The page is
expected to hide some textfields according to the selected Combobox
entry. The page works fine but WebTest fails setting the selectfield
reporting a script error. I thought about setting the hidden textfields
and appending the selected country to the request but as I'm supposed to
test if hiding textfields works this would not solve the problem. Here
are the relevant parts of the page. Any help would be appreciated.
.
.
<tr>
<th valign="top" class="Combobox2">
<span class="Combobox2">Land</span>
</th>
<td valign="top" class="Combobox2" style="">
<select name="obj(address).value(ADDRESSCOUNTRYCODE)"
onchange="displayAddressFormForCountry(this.options[this.options.selectedIndex].value)"
class="Combobox2">
<option value="DE">Deutschland</option>
<option value="FR">Frankreich</option>
<option value="GB">Großbritannien</option>
<option value="IT">Italien</option>
<option value="AT">Österreich</option>
<option value="CH">Schweiz</option>
<option value="ES">Spanien</option>
<option value="US">Vereinigte Staaten</option>
</select>
<img name="obj(address).value(ADDRESSCOUNTRYCODE)required"
src="/app-demo/campaign-web/images/clearpixel.gif">
</td>
</tr>
.
.
.
<script type="text/javascript" language="JavaScript">
<!--
var focusControl =
document.forms["searchform"].elements["obj(identification).value(PK)"];
if (focusControl.type != "hidden") {
focusControl.focus();
}
// -->
</script>
<script language="JavaScript" type="text/javascript">
<!--
displayAddressFormForCountry(document.forms["searchform"].elements["obj(address).value(ADDRESSCOUNTRYCODE)"].value);
//-->
</script>
Thanks in Advance,
Stefan