84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I executed this line of code to verify that there is some text on the title.
await expect(page.locator('div.welcome-content > h2')).not.toBeEmpty;
But when I execute it, this line of code does nothing, it neither asserts nor returns an error.
The correct way to use the expect function with the .not.toBeEmpty matcher is to put parentheses after .not.toBeEmpty to call the assertion and compare it with the actual value.
await expect(page.locator('div.welcome-content > h2')).not.toBeEmpty()
If you are using playwright's own assertion library, you can do this:
await expect(page.locator('div.welcome-content > h2')).toHaveText(text => text.length > 0);
The correct way to use the expect function with the .not.toBeEmpty matcher is to put parentheses after .not.toBeEmpty to call the assertion and compare it with the actual value.
If you are using playwright's own assertion library, you can do this: