Skip to content

[Bug]: page.getByRole(AriaRole.LINK) is not working for java #1896

@memo1025

Description

@memo1025

Version

1.58.0

Steps to reproduce

try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
page.navigate("https://playwright.dev");
System.out.println(page.title());

        System.out.println("Button = "+page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions()).count());
         System.out.println("Link = "+page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions()).count());

Expected behavior

Fast and reliable end-to-end testing for modern web apps | Playwright
Button = 3
Link = 39 // I tried node.js version and it works as normal for link count.

Actual behavior

Fast and reliable end-to-end testing for modern web apps | Playwright
Button = 3
Link = 0 // in java (21), link count returns 0.

Additional context

if I choose one of the links with codegen and try to click it , it returns error after timeout and locator be coudnt found . I tried .all() methot and it returns an empty array [].

Shortly, in my computer, Arial.LINK locator works for node.js but not for java 21.

Environment

Win 11
Amd Ryzen 7
Chrome 145.0.7632.117
Java 21
Node.js v22.13.0
playwright 1.58.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions