diff --git a/assertions/src/main/java/com/microsoft/playwright/assertions/APIResponseAssertions.java b/assertions/src/main/java/com/microsoft/playwright/assertions/APIResponseAssertions.java index c930ec91..932692f6 100644 --- a/assertions/src/main/java/com/microsoft/playwright/assertions/APIResponseAssertions.java +++ b/assertions/src/main/java/com/microsoft/playwright/assertions/APIResponseAssertions.java @@ -47,7 +47,7 @@ public interface APIResponseAssertions { */ APIResponseAssertions not(); /** - * Ensures the response status code is within [200..299) range. + * Ensures the response status code is within [200..299] range. *
{@code
* assertThat(response).isOK();
* }
diff --git a/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java b/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java
index 23f2da5b..e4095c48 100644
--- a/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java
+++ b/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java
@@ -452,7 +452,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -469,7 +469,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -484,7 +484,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -501,7 +501,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -516,7 +516,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -533,7 +533,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -548,7 +548,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -565,7 +565,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }
@@ -623,7 +623,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -639,7 +639,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -653,7 +653,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -669,7 +669,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -683,7 +683,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -699,7 +699,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -713,7 +713,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -729,7 +729,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }
@@ -872,7 +872,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -889,7 +889,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -904,7 +904,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -921,7 +921,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -936,7 +936,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -953,7 +953,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -968,7 +968,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
@@ -985,7 +985,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }
*
- * Note that if array is passed as an expected value, entire lists can be asserted: + *
Note that if array is passed as an expected value, entire lists of elements can be asserted: *
{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }
diff --git a/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java b/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java
index 978c9b54..6b536382 100644
--- a/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java
+++ b/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java
@@ -823,4 +823,11 @@ public class TestLocatorAssertions extends TestBase {
assertTrue(e.getMessage().contains("Locator expected not to be visible"), e.getMessage());
}
}
+
+ @Test
+ void locatorCountShouldWorkWithDeletedMapInMainWorld() {
+ page.evaluate("Map = 1");
+ page.locator("#searchResultTableDiv .x-grid3-row").count();
+ assertThat(page.locator("#searchResultTableDiv .x-grid3-row")).hasCount(0);
+ }
}
diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java
index 26c87af8..229dacbc 100644
--- a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java
+++ b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java
@@ -1017,6 +1017,13 @@ public class FrameImpl extends ChannelOwner implements Frame {
waitForNavigationImpl(() -> {}, convertType(options, WaitForNavigationOptions.class), matcher);
}
+ int queryCount(String selector) {
+ JsonObject params = new JsonObject();
+ params.addProperty("selector", selector);
+ JsonObject result = sendMessage("queryCount", params).getAsJsonObject();
+ return result.get("value").getAsInt();
+ }
+
protected void handleEvent(String event, JsonObject params) {
if ("loadstate".equals(event)) {
JsonElement add = params.get("add");
diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/LocatorImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/LocatorImpl.java
index ac0197ad..86d876ab 100644
--- a/playwright/src/main/java/com/microsoft/playwright/impl/LocatorImpl.java
+++ b/playwright/src/main/java/com/microsoft/playwright/impl/LocatorImpl.java
@@ -92,7 +92,7 @@ class LocatorImpl implements Locator {
@Override
public int count() {
- return ((Number) evaluateAll("ee => ee.length")).intValue();
+ return frame.queryCount(selector);
}
@Override
diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION
index e42639fb..310af5b9 100644
--- a/scripts/CLI_VERSION
+++ b/scripts/CLI_VERSION
@@ -1 +1 @@
-1.18.0-alpha-1641508844000
+1.18.0-alpha-jan-10-2022