question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Combo box selected value

See original GitHub issue

When 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:open
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
SotirisAntcommented, Apr 16, 2018

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

1reaction
SanjeevKumarmncommented, Sep 20, 2017

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(); }

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found