Skip to content

[Docs][Java] Incorrect return type mentioned for Locator.allInnerTexts() and Locator.allTextContents() #39899

Description

@TechExplorerSam

Version

1.58.0(latest at time of reporting)

Steps to reproduce

This is a documentation issue and does not require a runtime reproduction.

  1. Open the Playwright Java documentation / API reference.
  2. Refer to examples or descriptions around Locator.allInnerTexts() and Locator.allTextContents().
  3. The return type may be interpreted as String[].
  4. In Playwright Java, the actual return type is List.

Expected behavior

Java documentation and examples should explicitly indicate that
Locator.allInnerTexts() and Locator.allTextContents() return List.

Java examples should avoid implying an array (String[]), which is the return
type in JavaScript/TypeScript, not Java.

Actual behavior

The documentation/examples can be interpreted as implying a String[] return type.
This leads Java users to write code such as:

String[] texts = locator.allInnerTexts();

which does not compile, since the actual return type is List.

Additional context

This confusion is common for Java users coming from TypeScript/JavaScript,
where the return type is string[].

Clarifying the Java-specific return type would improve onboarding and reduce
misuse.

Environment

Not applicable – documentation issue.

This report is about Java API documentation clarity and does not depend on runtime
environment or execution behavior.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions