@@ -58,7 +58,7 @@ When an array is passed, the method asserts that the list of elements located ma
```
```java
-assertThat(page.locator("list > .component")).containsClass(new String[] {"inactive", "active", "inactive"});
+assertThat(page.locator(".list > .component")).containsClass(new String[] {"inactive", "active", "inactive"});
```
**Arguments**
@@ -285,7 +285,7 @@ assertThat(page.locator("#component")).hasClass(Pattern.compile("(^|\\s)selected
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class values. Each element's class attribute is matched against the corresponding string or regular expression in the array:
```java
-assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
+assertThat(page.locator(".list > .component")).hasClass(new String[] {"component", "component selected", "component"});
```
**Arguments**
diff --git a/nodejs/docs/api/class-locatorassertions.mdx b/nodejs/docs/api/class-locatorassertions.mdx
index 15103f22ea7..e23f2f82614 100644
--- a/nodejs/docs/api/class-locatorassertions.mdx
+++ b/nodejs/docs/api/class-locatorassertions.mdx
@@ -315,7 +315,7 @@ await expect(locator).toContainClass('row middle');
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class lists. Each element's class attribute is matched against the corresponding class in the array:
```html
-
@@ -323,7 +323,7 @@ When an array is passed, the method asserts that the list of elements located ma
```
```js
-const locator = page.locator('list > .component');
+const locator = page.locator('.list > .component');
await expect(locator).toContainClass(['inactive', 'active', 'inactive']);
```
@@ -589,7 +589,7 @@ await expect(locator).toHaveClass(/(^|\s)selected(\s|$)/);
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class values. Each element's class attribute is matched against the corresponding string or regular expression in the array:
```js
-const locator = page.locator('list > .component');
+const locator = page.locator('.list > .component');
await expect(locator).toHaveClass(['component', 'component selected', 'component']);
```
diff --git a/python/docs/api/class-locatorassertions.mdx b/python/docs/api/class-locatorassertions.mdx
index 0a327964516..038085b15ca 100644
--- a/python/docs/api/class-locatorassertions.mdx
+++ b/python/docs/api/class-locatorassertions.mdx
@@ -1294,7 +1294,7 @@ await expect(locator).to_contain_class("row middle")
When an array is passed, the method asserts that the list of elements located matches the corresponding list of expected class lists. Each element's class attribute is matched against the corresponding class in the array:
```html
-
+
@@ -1314,7 +1314,7 @@ When an array is passed, the method asserts that the list of elements located ma
```py
from playwright.sync_api import expect
-locator = page.locator("list > .component")
+locator = page.locator(".list > .component")
await expect(locator).to_contain_class(["inactive", "active", "inactive"])
```
@@ -1324,7 +1324,7 @@ await expect(locator).to_contain_class(["inactive", "active", "inactive"])
```py
from playwright.async_api import expect
-locator = page.locator("list > .component")
+locator = page.locator(".list > .component")
await expect(locator).to_contain_class(["inactive", "active", "inactive"])
```
@@ -1741,7 +1741,7 @@ When an array is passed, the method asserts that the list of elements located ma
```py
from playwright.sync_api import expect
-locator = page.locator("list > .component")
+locator = page.locator(".list > .component")
expect(locator).to_have_class(["component", "component selected", "component"])
```
@@ -1751,7 +1751,7 @@ expect(locator).to_have_class(["component", "component selected", "component"])
```py
from playwright.async_api import expect
-locator = page.locator("list > .component")
+locator = page.locator(".list > .component")
await expect(locator).to_have_class(["component", "component selected", "component"])
```