iterated optgroup options and select each option.

13 views
Skip to first unread message

jerald

unread,
Dec 16, 2009, 7:15:21 AM12/16/09
to watij
Dear friends,

I have this requirement. i made a search for this in our group. but i
found none. so i post this question.

I have a option group like this
<select>
<optgroup label="test1">
<option>a</option>
<option>b</option>
<option>c</option>
</optgroup>
<optgroup label="test2">
<option>a</option>
<option>b</option>
<option>c</option>
</optgroup>
</select>
<input type="button1" name="buttontest1"/>

in this, i have to select option a under label test1 and click on this
button. How do i achieve this?

please help!!

Thanks and Regards
Jerald

Darrell Grainger

unread,
Dec 16, 2009, 10:54:55 AM12/16/09
to wa...@googlegroups.com
You can use xpath to find the option. For example,

Option o = ie.option(xpath,
"//SELECT/OPTGROUP[@label='test1']/OPTION[@text='a']");



2009/12/16 jerald <paulj...@gmail.com>:
> --
>
> You received this message because you are subscribed to the Google Groups "watij" group.
> To post to this group, send email to wa...@googlegroups.com.
> To unsubscribe from this group, send email to watij+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/watij?hl=en.
>
>
>

Jerald paul

unread,
Dec 17, 2009, 12:30:39 AM12/17/09
to wa...@googlegroups.com
Dear Darrell,

Thanks for your nice suggestion. I will try this out and tell you the progress.  Thanks again.


Thanks and Kind Regards
jerald




2009/12/16 Darrell Grainger <darrell....@gmail.com>
Reply all
Reply to author
Forward
0 new messages