From 1f3e019ca9ab22fb5fb44fc9dc9d6df16b596d36 Mon Sep 17 00:00:00 2001 From: JAYA DILEEP Date: Mon, 14 Sep 2026 19:40:01 +0000 Subject: [PATCH] docs: expose toHaveAttribute presence assertion to Java Include java in LocatorAssertions.toHaveAttribute#2 langs filter with alias hasAttribute so playwright-java can generate the API. Refs: microsoft/playwright-java#1844 Requested on microsoft/playwright-java#1975 Signed-off-by: JAYA DILEEP --- docs/src/api/class-locatorassertions.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 200c4ec204455..ca0b263d98478 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -1591,7 +1591,8 @@ Expected attribute value. If not specified, the assertion verifies that the attr ## async method: LocatorAssertions.toHaveAttribute#2 * since: v1.39 -* langs: js +* langs: js, java + - alias-java: hasAttribute Ensures the [Locator] points to an element with given attribute. The method will assert attribute presence. @@ -1603,6 +1604,11 @@ await expect(locator).toHaveAttribute('disabled'); await expect(locator).not.toHaveAttribute('open'); ``` +```java +assertThat(locator).hasAttribute("disabled"); +assertThat(locator).not().hasAttribute("open"); +``` + ### param: LocatorAssertions.toHaveAttribute#2.name * since: v1.39 - `name` <[string]> @@ -1615,6 +1621,9 @@ Attribute name. ### option: LocatorAssertions.toHaveAttribute#2.signal = %%-js-assertions-signal-%% * since: v1.62 +### option: LocatorAssertions.toHaveAttribute#2.timeout = %%-csharp-java-python-assertions-timeout-%% +* since: v1.39 + ## async method: LocatorAssertions.toHaveClass * since: v1.20 * langs: