Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions

Jump to navigation Jump to search
m
Line 379: Line 379:


=== Radio Buttons ===
=== Radio Buttons ===
<nowiki>
//await usingTheGridForm.getByLabel('Option 1').check({force:true})
await usingTheGridForm
    .getByRole("radio", { name: "Option 1" })
    .check({ force: true })
const radioStatus = await usingTheGridForm
    .getByRole("radio", { name: "Option 1" })
    .isChecked()
expect(radioStatus).toBeTruthy()
await expect(
    usingTheGridForm.getByRole("radio", { name: "Option 1" })
).toBeChecked()
await usingTheGridForm
    .getByRole("radio", { name: "Option 2" })
    .check({ force: true })
expect(
    await usingTheGridForm
    .getByRole("radio", { name: "Option 1" })
    .isChecked()
).toBeFalsy()
expect(
    await usingTheGridForm
        .getByRole("radio", { name: "Option 2" })
        .isChecked()
).toBeTruthy()</nowiki>
=== Checkboxes ===
=== Checkboxes ===
=== Lists & Dropdowns ===
=== Lists & Dropdowns ===

Navigation menu