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 02:17, 29 May 2024
, 29 May→Navigation Page Object
Line 772: | Line 772: | ||
=== Navigation Page Object === | === Navigation Page Object === | ||
As per above section, but adding/modifying | |||
<nowiki> | |||
async datePickerPage() { | |||
await this.selectGroupMenuItem("Forms") | |||
await this.page.locator(".menu-item").getByText("Datepicker").click() | |||
} | |||
/* other menu items */ | |||
private async selectGroupMenuItem(groupItemtitle: string) { | |||
const groupMenuItem = this.page.getByTitle(groupItemtitle) | |||
const expandedState = await groupMenuItem.getAttribute("aria-expanded") | |||
if (expandedState == "false") { | |||
await groupMenuItem.click() | |||
} | |||
}</nowiki> | |||
=== Locators in Page Objects === | === Locators in Page Objects === | ||
=== Parameterised Methods === | === Parameterised Methods === |