1

How to select an element of a dropdown list? Here is my code:

await page.select("#cboTypeMess", "3")

to select:

<select id="cboTypeMess" name="cboTypeMess" 
`onchange="javascript:DoPostBack('GKfUxv0u+6p3itjfUI4rBsk6/l8+TspfMKgWMhPlzDZa+1fOPN7aOvWgsWUgAs4VNDWAXOxhtluVHrmGMZEI9js/vcWlc8acqwuMHy+oxU9OG9Zr','','',false,true);">
<option value="1" selected="">Individu
</option><option value="3">Groupe
</option></select>

Is there a way to change the selected option (like click on Individu button/value 1?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
  • This tiny snippet of HTML probably doesn't make the example reproducible -- it's not clear that it's even visible when your code runs. Can you share the actual page (or a representative [mcve]) and desired result? The code you gave [should work](https://stackoverflow.com/questions/45864516/how-to-select-an-option-from-dropdown-select), so what went wrong exactly with it? Also, are you sure you wnat to tag this [tag:java] and not [tag:javascript]? The two are very different languages. Thanks for clarifying – ggorlen Mar 15 '22 at 15:16
  • 1
    Does this answer your question? [How to select an option from dropdown select](https://stackoverflow.com/questions/45864516/how-to-select-an-option-from-dropdown-select) – ggorlen Mar 15 '22 at 15:18

0 Answers0