Interface PageAssertions
-
public interface PageAssertionsThePageAssertionsclass provides assertion methods that can be used to make assertions about thePagestate in the tests.{@code ... import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; public class TestPage { ...
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPageAssertions.HasTitleOptionsstatic classPageAssertions.HasURLOptions
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidhasTitle(String titleOrRegExp)Ensures the page has the given title.voidhasTitle(String titleOrRegExp, PageAssertions.HasTitleOptions options)Ensures the page has the given title.default voidhasTitle(Pattern titleOrRegExp)Ensures the page has the given title.voidhasTitle(Pattern titleOrRegExp, PageAssertions.HasTitleOptions options)Ensures the page has the given title.default voidhasURL(String urlOrRegExp)Ensures the page is navigated to the given URL.voidhasURL(String urlOrRegExp, PageAssertions.HasURLOptions options)Ensures the page is navigated to the given URL.default voidhasURL(Pattern urlOrRegExp)Ensures the page is navigated to the given URL.voidhasURL(Pattern urlOrRegExp, PageAssertions.HasURLOptions options)Ensures the page is navigated to the given URL.PageAssertionsnot()Makes the assertion check for the opposite condition.
-
-
-
Method Detail
-
not
PageAssertions not()
Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain"error":assertThat(page).not().hasURL("error");- Since:
- v1.20
-
hasTitle
default void hasTitle(String titleOrRegExp)
Ensures the page has the given title.Usage
assertThat(page).hasTitle("Playwright");- Parameters:
titleOrRegExp- Expected title or RegExp.- Since:
- v1.20
-
hasTitle
void hasTitle(String titleOrRegExp, PageAssertions.HasTitleOptions options)
Ensures the page has the given title.Usage
assertThat(page).hasTitle("Playwright");- Parameters:
titleOrRegExp- Expected title or RegExp.- Since:
- v1.20
-
hasTitle
default void hasTitle(Pattern titleOrRegExp)
Ensures the page has the given title.Usage
assertThat(page).hasTitle("Playwright");- Parameters:
titleOrRegExp- Expected title or RegExp.- Since:
- v1.20
-
hasTitle
void hasTitle(Pattern titleOrRegExp, PageAssertions.HasTitleOptions options)
Ensures the page has the given title.Usage
assertThat(page).hasTitle("Playwright");- Parameters:
titleOrRegExp- Expected title or RegExp.- Since:
- v1.20
-
hasURL
default void hasURL(String urlOrRegExp)
Ensures the page is navigated to the given URL.Usage
assertThat(page).hasURL(".com");- Parameters:
urlOrRegExp- Expected URL string or RegExp.- Since:
- v1.20
-
hasURL
void hasURL(String urlOrRegExp, PageAssertions.HasURLOptions options)
Ensures the page is navigated to the given URL.Usage
assertThat(page).hasURL(".com");- Parameters:
urlOrRegExp- Expected URL string or RegExp.- Since:
- v1.20
-
hasURL
default void hasURL(Pattern urlOrRegExp)
Ensures the page is navigated to the given URL.Usage
assertThat(page).hasURL(".com");- Parameters:
urlOrRegExp- Expected URL string or RegExp.- Since:
- v1.20
-
hasURL
void hasURL(Pattern urlOrRegExp, PageAssertions.HasURLOptions options)
Ensures the page is navigated to the given URL.Usage
assertThat(page).hasURL(".com");- Parameters:
urlOrRegExp- Expected URL string or RegExp.- Since:
- v1.20
-
-