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

Jump to navigation Jump to search
m
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 ===

Navigation menu