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

Jump to navigation Jump to search
m
Line 156: Line 156:


==== Child Elements ====
==== Child Elements ====
<nowiki>test("Locating child elements", async ({ page }) => {
  await page.locator('nb-card nb-radio :text-is("Option 1")').click()
  await page.locator('nb-card').locator('nb-radio').locator(':text-is("Option 2")').click() // this is nicer than line above
  await page.locator('nb-card').getByRole('button', {name: "Sign In"}).first().click() // avoid first last, and nth because the lists enveriably change
  await page.locator('nb-card').nth(3).getByRole('button').click()
})</nowiki>
==== Parent Elements ====

Navigation menu