jest-puppeteer icon indicating copy to clipboard operation
jest-puppeteer copied to clipboard

ability toClick() radioButtons

Open abhidp opened this issue 5 years ago • 2 comments

🚀 Feature Proposal

Please provide the ability to select radioButtons and checkBoxes via .toClick() function

Motivation

There is no easy way to target Radio Buttons and Check Boxes based on their values like there is a function to select values from Dropdowns

Example

something like

await expect(page).toClick('radio', { value: 'Yes' });

for the element:

<input id="taxClient" type="radio" value="Yes">

image

abhidp avatar Feb 17 '20 05:02 abhidp

Hi, so I haven't tried this but does await expect(page).toClick('input[type="radio"][value="Yes"]'); work?

kme211 avatar Mar 03 '20 15:03 kme211

I use this for radio buttons until the feature is ready:

await page.evaluate(() => { let radio = document.querySelector("#myRadio"); radio.click(); });

f-g-s avatar Feb 10 '22 16:02 f-g-s

Using the correct selector it works, so I close this issue.

gregberge avatar Mar 08 '23 12:03 gregberge