code: def test_handles_option_selection(
      app: Page, assert_snapshot: ImageCompareFunction
  ):
      """Test that selection of an option via the dropdown works correctly."""
      app.get_by_test_id("stSelectbox").nth(3).locator("input").click()
  
      # Take a snapshot of the selection dropdown:
      selection_dropdown = app.locator('[data-baseweb="popover"]').first
      assert_snapshot(
          selection_dropdown, name="st_selectbox-selection_dropdown"
      )
      # Select last option:
      selection_dropdown.locator("li").nth(1).click()
      # Check that selection worked:
      expect(app.get_by_test_id("stMarkdown").nth(3)).to_have_text(
          "value 4: e2e/scripts/st_warning.py", use_inner_text=True
      )
  
file_path: streamlit/e2e_playwright/st_selectbox_test.py
imports: from playwright.sync_api import Page, expect
  from e2e_playwright.conftest import ImageCompareFunction
label_desc: Use image node_id 3 for calling a global function with example usage: test_handles_option_selection(app, assert_snapshot) without return types