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

Jump to navigation Jump to search
m
Line 410: Line 410:


=== Checkboxes ===
=== Checkboxes ===
<nowiki>
await page.getByText("Modal & Overlays").click()
await page.locator(".menu-item").getByText("Toastr").click()
await page
  .getByRole("checkbox", { name: "Hide on click" })
  .uncheck({ force: true })
await page
  .getByRole("checkbox", { name: "Prevent arising of duplicate toast" })
  .check({ force: true })
const checkBoxes = page.getByRole("checkbox")
for (const checkbox of await checkBoxes.all()) {
  await checkbox.uncheck({ force: true })
  expect(await checkbox.isChecked()).toBeFalsy()
}</nowiki>
I couldn't get <code>const checkBoxes = await page.getByRole("checkbox").all()<code> and then use array forEach(...) to work, not sure why ... but using the for loop is documented in the method tooltip ...
=== Lists & Dropdowns ===
=== Lists & Dropdowns ===
=== Tooltips ===
=== Tooltips ===

Navigation menu