-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Resolve <select> element based on label text #4400
Comments
Hi @yury-s, Not sure why github is not formatting this message properly but... I have a select (drop-down box) like this (note <label for="cityId">City</label>
<div class="css-class-1 css-class-2">
<select name="cityId" id="cityId" data-testid="city">
<option value="">Please select...</option>
<option value="1001">Mumbai</option>
<option value="1006">Delhi</option>
</select>
</div> I've tried to select it using
or
or even
but no luck
but the browser does not register the selection What could I be missing here? |
It should be await page.selectOption('text=City', {label: 'Mumbai'}); By default the second parameter is matched against await page.selectOption('text=City', '1001'); |
Awesome! that works! Thanks @yury-s for the quick reply |
Does label match works with regex? |
It would be amazing to have something similar to #3466 but for
<select>
elements.Then allow using
await page.selectOption('text=Choose a pet', 'dog')
The text was updated successfully, but these errors were encountered: