Skip to content
CodeKruPro

Get All Dropdown Options

28/70

Get All Dropdown Options

Use locator.locator('option') to get all options in a select element, then iterate with .all().

Task:

  1. Navigate to https://testkru.com/Elements/Dropdowns
  2. Get all options from #singleSelect
  3. Print the total count
  4. Print each option's visible text (skip the placeholder)

Expected output:

Total options: 6
Java
Python
JavaScript
C#
Ruby