Skip to content

[Bug]: Playwright locator from generateLocator refers to the wrong html element #32903

Open
@fabianboth

Description

@fabianboth

Version

1.47.2

Steps to reproduce

On https://www.redbus.in/, click the calendar dropdown.

Then try to generate a locator with playwright.generateLocator for any of the date fields.

Expected behavior

Getting a playwright locator, that could click the respective date field when using locator.click().
Similar to clicking with the mouse on the date entry, this should select the correct date in the date picker.

Actual behavior

The locator refers to a button which opened the calendar drop-down. All dates refer to this button, and clicking does not select a date.

Additional context

This is the mentioned calendar dropdown:
image

If e.g. 10th of Oct is selected as element, the playwright locator resolves to the button element instead
image

The element where the locator points to
image

Environment

System:
    OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz
    Memory: 15.38 GB / 31.05 GB
    Container: Yes
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    pnpm: 9.11.0 - ~/.nvm/versions/node/v20.15.1/bin/pnpm
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  npmPackages:
    @playwright/test: 1.47.2 => 1.47.2 
    playwright-core: 1.47.2 => 1.47.2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions