diff --git a/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java b/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java index e294e1d9..c56429fd 100644 --- a/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java +++ b/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java @@ -30,7 +30,7 @@ import java.util.regex.Pattern; *

**Strictness** * *

Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches - * given selector. + * a given selector. *

{@code
  * // Throws if there are several frames in DOM:
  * page.frame_locator(".result-frame").locator("button").click();
diff --git a/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java b/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java
index 695c7b42..d7f9c460 100644
--- a/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java
+++ b/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java
@@ -795,7 +795,7 @@ public interface LocatorAssertions {
    */
   void containsText(Pattern[] expected, ContainsTextOptions options);
   /**
-   * Ensures the {@code Locator} points to an element with given attribute value.
+   * Ensures the {@code Locator} points to an element with given attribute.
    * 
{@code
    * assertThat(page.locator("input")).hasAttribute("type", "text");
    * }
@@ -807,7 +807,7 @@ public interface LocatorAssertions { hasAttribute(name, value, (HasAttributeOptions) null); } /** - * Ensures the {@code Locator} points to an element with given attribute value. + * Ensures the {@code Locator} points to an element with given attribute. *
{@code
    * assertThat(page.locator("input")).hasAttribute("type", "text");
    * }
@@ -817,7 +817,7 @@ public interface LocatorAssertions { */ void hasAttribute(String name, String value, HasAttributeOptions options); /** - * Ensures the {@code Locator} points to an element with given attribute value. + * Ensures the {@code Locator} points to an element with given attribute. *
{@code
    * assertThat(page.locator("input")).hasAttribute("type", "text");
    * }
@@ -829,7 +829,7 @@ public interface LocatorAssertions { hasAttribute(name, value, (HasAttributeOptions) null); } /** - * Ensures the {@code Locator} points to an element with given attribute value. + * Ensures the {@code Locator} points to an element with given attribute. *
{@code
    * assertThat(page.locator("input")).hasAttribute("type", "text");
    * }
@@ -838,28 +838,6 @@ public interface LocatorAssertions { * @param value Expected attribute value. */ void hasAttribute(String name, Pattern value, HasAttributeOptions options); - /** - * Ensures the {@code Locator} points to an element with given attribute. The method will assert attribute presence. - *
{@code
-   * assertThat(page.locator("input")).hasAttribute("disabled");
-   * assertThat(page.locator("input")).not().hasAttribute("open");
-   * }
- * - * @param name Attribute name. - */ - default void hasAttribute(String name) { - hasAttribute(name, (HasAttributeOptions) null); - } - /** - * Ensures the {@code Locator} points to an element with given attribute. The method will assert attribute presence. - *
{@code
-   * assertThat(page.locator("input")).hasAttribute("disabled");
-   * assertThat(page.locator("input")).not().hasAttribute("open");
-   * }
- * - * @param name Attribute name. - */ - void hasAttribute(String name, HasAttributeOptions options); /** * Ensures the {@code Locator} points to an element with given CSS classes. This needs to be a full match or using a relaxed * regular expression. diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java index f6b9e5ee..b7dfb22d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java @@ -105,18 +105,7 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse if (expectedValue instanceof Pattern) { message += " matching regex"; } - expectImpl("to.have.attribute.value", expectedText, expectedValue, message, commonOptions); - } - - @Override - public void hasAttribute(String name, HasAttributeOptions options) { - if (options == null) { - options = new HasAttributeOptions(); - } - FrameExpectOptions commonOptions = convertType(options, FrameExpectOptions.class); - commonOptions.expressionArg = name; - String message = "Locator expected to have attribute '" + name + "'"; - expectImpl("to.have.attribute", (List) null, null, message, commonOptions); + expectImpl("to.have.attribute", expectedText, expectedValue, message, commonOptions); } @Override diff --git a/playwright/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java b/playwright/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java index 3860acda..600f6dca 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java @@ -284,28 +284,6 @@ public class TestLocatorAssertions extends TestBase { assertTrue(e.getMessage().contains("Locator expected to have attribute 'id' matching regex: .Nod..\nReceived: node"), e.getMessage()); } - @Test - void hasAttributeBooleanPass() { - page.setContent("
Text content
"); - Locator locator = page.locator("#node"); - assertThat(locator).hasAttribute("id"); - assertThat(locator).hasAttribute("checked"); - assertThat(locator).not().hasAttribute("open"); - assertThat(locator).hasAttribute("id", Pattern.compile("n..e")); - } - - @Test - void hasAttributeBooleanFail() { - page.setContent("
Text content
"); - Locator locator = page.locator("#node"); - AssertionFailedError e = assertThrows(AssertionFailedError.class, - () -> assertThat(locator).hasAttribute("disabled", new LocatorAssertions.HasAttributeOptions().setTimeout(100))); - assertTrue(e.getMessage().contains("Locator expected to have attribute 'disabled'"), e.getMessage()); - e = assertThrows(AssertionFailedError.class, - () -> assertThat(locator).not().hasAttribute("checked", new LocatorAssertions.HasAttributeOptions().setTimeout(100))); - assertTrue(e.getMessage().contains("Locator expected not to have attribute 'checked'"), e.getMessage()); - } - @Test void hasClassTextPass() { page.setContent("
"); diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION index aec42b29..5ff8c4f5 100644 --- a/scripts/CLI_VERSION +++ b/scripts/CLI_VERSION @@ -1 +1 @@ -1.26.0-beta-1662762342000 +1.26.0