Deselecting an Option and Selecting a new option

Hello,

So i ran into a dropdown that has a option selected by default. in the html it says “value selected”. I try selecting the other option by its value and its index but nothing is working for me. There is only two options to select from, Any ideas?

Firstly, a question: How does a regular user select a different option?

If this is a regular HTML select element, you could use sendKeys and send a space to it. Sounds tricky though.

If this is not a regular select, I think you’ll need to post the relevant HTML to help us get an idea of what you’re dealing with. It’s also possible it has a JavaScript API we could use.

Try this:

It didn’t work for me i received and error
:You may only deselect options of a multi-select)

This is a regular select element – as long as there is no surrounding styling that makes it invisible and uses framework to mimic a select. From the HTML you’ve managed to share, it’s a regular select. So…

You shouldn’t need to deselect. You should be able to use the regular WebUI.select* APIs.

for some reason it would only work if i used select by Label. Got it to work and thanks for your help!

1 Like