Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to select a color from the dropdown list below
pan class="a_nB9P0oL7vheRL31R_0 z_nB9P0oL7vheRL31R_0 cy_nB9P0oL7vheRL31R_0 c0_nB9P0oL7vheRL31R_0" style="white-space: nowrap;" 
onmouseover="return LeafControl.OnWrappingSpanMouseOver(this, event);" onmouseout="return LeafControl.OnWrappingSpanMouseOut(this, event);
"><select tabindex="0" title="" class="y_nB9P0oL7vheRL31R_0 aa_nB9P0oL7vheRL31R_0 cz_nB9P0oL7vheRL31R_0 cu_nB9P0oL7vheRL31R_0" 
id="FormControl_V1_I1_R8_I5_D1" style="direction: ltr;" onfocus="return (DropDownList.OnFocus(this, event));" onblur="return (DropDownList.OnBlur(this, event));" 
onchange="return (DropDownList.OnChange(this, event));" viewdatanode="32" originalid="V1_I1_R8_I5_D1" formid="FormControl" scriptclass="DropDownList" direction="ltr" 
wrapped="true">
<option value=""></option>
<option value="blue">blue</option>
<option value="red">red</option>
<option value="orange">orange</option>
<option value="yellow">yellow</option>
<option value="green">green</option>
</select></span>


What I have tried:

mybrowser.Document.getelementbyid("FormControl_V1_I1_R8_I5_D1").value = "blue"
Posted
Updated 26-Jul-20 4:22am
v2
Comments
Sandeep Mewara 26-Jul-20 2:56am    
And the issue is?

BTW, whatever you mentioned in 'What I tried' has wrong casings. like: document => Document, getEleementById => getelementbyid
Member 13305034 26-Jul-20 13:04pm    
Below is the code I added but still not working. I AM working with this for many hours without a solution and have many codes working but this one for some reason not. I saw a onblur, onfocus and onchange on the webbrowser. Below is one of the code used. COdeprojec.com is my favorite websites for support hope one of the members have a solution.
For Each element As HtmlElement In mybrowser.Document.GetElementsByTagName("select")

mybrowser.Document.getElementById("FormControl_V1_I1_R8_I" & cnt1 & "_D1").value = "blue"

End If
Next
Sandeep Mewara 26-Jul-20 13:47pm    
As shared earlier, did you try with correct casing? JavaScript is sensitive to that.

==

document.getElementsByTagName("select")

document.getElementById("FormControl_V1_I1_R8_I" & cnt1 & "_D1").value = "blue"

===
Member 13305034 26-Jul-20 13:56pm    
Hello! Yes, I did. Any recommendation? or new way to set the attribute?
Member 13305034 26-Jul-20 14:12pm    
Below is a visual view when selected
option value="blue" selected=""blue/option
just in case you know the solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900