html - Webbrowser select value from dynamic combobox -
i trying automate form being filled out webbrowser control vb.net
the problem there 2 comboboxes, second having values generated depending on first one. can correct index selected first combobox, second values never generated. have manually select value first combobox , second populated.
i have tried setting/removing focus of first combobox try , second populate, has not worked.
my current code is:
''select first combo box dim make htmlelement make = webbrowser1.document.getelementbyid("cars.carmake_s") make.setattribute("selectedindex", 1) webbrowser1.update() ''should select second value, doesn't dim model htmlelement model = webbrowser1.document.getelementbyid("cars.carmake_s+cars.carmodel_s") model.setattribute("selectedindex", 2) webbrowser1.update()
the html code playing (cut down):
<div class="form-row clearfix"> <label for="cars.carmake_s"> make<span class="orange">*</span> </label> <div class="form-value"> <div class="c-select-list c-slctbx-medium"> <span class="c-icon c-icon-arrow-green-down"></span> <select id="cars.carmake_s" name="attributemap[cars.carmake_s]" class="c-slctbx-depnode c-slctbx-medium" name="attributemap[cars.carmake_s]"><option value="">please choose</option> <option value="alpharomeo" > alfa romeo</option> .... ... ... </select></div> </div> <div class="form-row clearfix"> <label for="cars.carmodel_s"> model<span class="orange">*</span> </label> <div class="form-value"> <div class="c-select-list c-slctbx-medium"> <span class="c-icon c-icon-arrow-green-down"></span> <!-->####this second combobox , gets populated depending on first combobox<!--> <select id="cars.carmake_s+cars.carmodel_s" name="attributemap[cars.carmodel_s]" class=" c-slctbx-medium" name="attributemap[cars.carmodel_s]"><option value="">please choose</option> </select></div> </div> </div>
you might try following:
curelement.setattribute("value", "value want")
curelement.raiseevent("onchange")
Comments
Post a Comment