Recently I’ve been playing around with a webbrowser control to automate my interaction with a website for testing purposes. I am using C# and DOT NET.

I found it a bit difficult to change the value of an HTML combobox (i.e. dropdown), but as it turns out it’s rather easy.I used the following code to change the value of a combobox named: “test” to the value 12.

This code was used for the following HTML:

Finally the following code was required to press the “Submit” button.

2 thoughts on “Selecting the value of an HTML combobox programmatically using a WebBrowser Control

  1. thanks for your code
    I follow it step by step and it changes the value of the combo, but it doesn’t display the changed value, even if the “selected” property changed from false to true.
    I searched such prob in the net, and I find your post the best one, but unfortunately is sill unaccomplished.


Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url=""> 


Page last modified: 05:57 on November 6, 2013 (UTC+2)