VLearnVibium

How to Select a Dropdown Option in Vibium

Select a dropdown option in Vibium with el.selectOption(). Runnable Python examples for value, label, and multi-select, plus auto-waiting tips.

By Pramod Dutta··3 min read·Verified with Vibium 26.2
▶ Animated overview · made with Remotion

To select a dropdown option in Vibium, find the <select> element and call selectOption() with the option you want, like vibe.find("#country").selectOption("US"). Vibium sets the value on the native select element and dispatches a change event, so any JavaScript bound to the dropdown — filtering a list, revealing dependent fields, recalculating a price — runs exactly as it would when a person picks the option. This works for the standard HTML <select> control, and you can pass the option's value attribute, its visible label, or a list of values for multi-select fields. Because selectOption() operates on the element you already located with find(), you get Vibium's auto-waiting for free: the select must exist and be ready before the value is set. The result is a one-line, reliable way to choose from native dropdowns without scripting individual option clicks.

How do I select an option by value?

Locate the <select> with find() and call selectOption(), passing the option's value attribute. Vibium updates the select and fires a change event.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com/signup")
 
# Select the option whose value attribute is "US"
vibe.find("#country").selectOption("US")
 
vibe.quit()

Selecting by value is the most stable approach because the value attribute rarely changes even when the visible label is reworded or translated. If you do not know the values, inspect the <option> tags in the dropdown's markup, or select by the visible label instead as shown next.

How do I select an option by its visible text?

When you only know what the user sees, target the option by its visible label. This is convenient for human-readable choices like "United States" or "Standard Shipping".

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com/checkout")
 
# Select by the label the user reads in the dropdown
vibe.find("#shipping").selectOption("Express")
 
vibe.quit()

Either way, Vibium dispatches the change event after setting the selection, so dependent UI updates the same as a real choice. To confirm the selection took effect, read it back and verify with getting element text or value.

How do I select multiple options?

For a multi-select dropdown, pass a list of values to selectOption(). Vibium selects every matching option in one call and dispatches a single change event.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com/preferences")
 
# Choose several options in one call
vibe.find("#colors").selectOption(["red", "green", "blue"])
 
vibe.quit()

This is far cleaner than holding a modifier key and clicking each option by hand. One call selects the whole set and fires the change event once, so listeners that aggregate the selection — a tag counter or a filtered result list — update correctly.

What about custom dropdowns that are not native selects?

Many modern UIs build dropdowns from <div> and <ul> elements instead of a native <select>. selectOption() targets real <select> controls, so for a custom widget you click it open and then click the option like any other element.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com")
 
# Custom dropdown: click to open, then click the option
vibe.find(".dropdown-toggle").click()
vibe.find(role="option", text="Premium").click()
 
vibe.quit()

Vibium auto-waits on each click, so the option list has time to render before you select from it. If you are unsure whether a control is a native select, inspect its tag — a real <select> uses selectOption(), while everything else is click-to-open. See how to click elements in Vibium for the follow-up click and waiting and actionability for how the waiting works.

Next steps

Frequently asked questions

How do I select a dropdown option in Vibium?

Find the select element and call selectOption() with the option's value, like vibe.find('#country').selectOption('US'). Vibium sets the value on the native select and dispatches a change event, so the page reacts exactly as it would when a user picks an option.

Can I select a dropdown option by its visible text in Vibium?

Yes. selectOption() accepts the option's value attribute, and you can also pass the visible label depending on how the option is matched. For a native select, target the option whose value or text matches your choice, then Vibium fires the change event automatically.

How do I select multiple options in Vibium?

For a multi-select element, pass a list of values to selectOption(), such as selectOption(['red', 'green']). Vibium selects each matching option and dispatches a single change event, so multi-choice fields update in one call rather than several clicks.

Vibium is created by Jason Huggins. This is an independent tutorial — see the official Vibium site and GitHub repo for canonical docs.

Related guides