Combo box selected value
See original GitHub issueWhen I,m trying to get the selected value from a combo box it is throwing an error like “unsupported command exception”. I used the following code.
Select locatoin = new Select(driver.findElement(By.id("cmbLocation")));
String option = locatoin .getFirstSelectedOption().getText();
What are the other possible ways to get the selected option?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
Get selected value from combo box in C# WPF
You can either use SelectedIndex and use ComboBox.Items[SelectedIndex].ToString(). Or just ComboBox.SelectedItem and cast it to any type you ...
Read more >ComboBox.SelectedItem Property (System.Windows.Forms)
When you set the SelectedItem property to an object, the ComboBox attempts to make that object the currently selected one in the list....
Read more >Get Selected Value of a ComboBox in C# | Delft Stack
Use the ComboBox.SelectedItem Property to Get the Selected Value of a ComboBox in C# ... In .NET's ComboBox control, the .SelectedItem property ...
Read more >Selection in Windows Forms ComboBox (SfComboBox)
Value of the selected item can be retrieved by using the SelectedValue property. It returns the property value bind to the ValueMember property....
Read more >[SOLVED] how to get and use the value of a combobox
To access the selected value from the combobox, you either need to pass the combobox itself to the method, or pass the selected...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello,
I had a similar issue but at the end, I managed to get the selected value from a combo-box with the below code:
ComboBox comboBox = new ComboBox(anElement);
String value = comboBox.getAttribute("Name");
Hope this helps!
Br, Sotiris
here what I did for selecting the combo, try using one of the below method to get values of dropdown -
public void select_combo_by_id(String ID,String select_text){ WebElement env_combo = driver.findElement(By.id(ID)); ComboBox debs_combo = new ComboBox(env_combo); debs_combo.expand(); driver.findElement(By.name(select_text)).click(); }