Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions
Jump to navigation
Jump to search
Udemy Playwright: Web Automation Testing From Zero to Hero (view source)
Revision as of 03:59, 21 May 2024
, 21 May→Child Elements
m (→x) |
m (→Child Elements) |
||
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 ==== |