Expect
Playwright\Testing\ExpectInterface
Methods
toBeAttached()
voidfunction toBeAttached(): void
toBeVisible()
voidfunction toBeVisible(): void
toBeHidden()
voidfunction toBeHidden(): void
toHaveText()
voidfunction toHaveText(string $text): void
toContainText()
voidfunction toContainText(string $text): void
toHaveExactText()
voidfunction toHaveExactText(string $text): void
toHaveValue()
voidfunction toHaveValue(string $value): void
toHaveAttribute()
voidfunction toHaveAttribute(string $name, string $value): void
toBeChecked()
voidfunction toBeChecked(): void
toBeEnabled()
voidfunction toBeEnabled(): void
toBeDisabled()
voidfunction toBeDisabled(): void
toHaveCSS()
voidfunction toHaveCSS(string $name, string $value): void
toHaveId()
voidfunction toHaveId(string $id): void
toHaveClass()
voidAsserts the element's class attribute matches the expected list exactly. Order matters and extra classes fail the assertion. Use an array or a space-separated string interchangeably; surrounding and repeated whitespace is ignored on both sides.
function toHaveClass(string|array $class): void
toBeEmpty()
voidfunction toBeEmpty(): void
toHaveCount()
voidfunction toHaveCount(int $count): void
toBeFocused()
voidfunction toBeFocused(): void
toHaveFocus()
voidfunction toHaveFocus(): void
toHaveTitle()
voidfunction toHaveTitle(string $title): void
toHaveURL()
voidfunction toHaveURL(string $url): void
not()
selffunction not(): self
withTimeout()
selffunction withTimeout(int $timeoutMs): self
withPollInterval()
selffunction withPollInterval(int $pollIntervalMs): self