Update writing-tests-java.md sample code (#19894)
Fix code compilation issues reported in https://github.com/microsoft/playwright-java/issues/1158
This commit is contained in:
parent
ef877dadfe
commit
9f7b0e4e01
|
|
@ -12,6 +12,7 @@ package org.example;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import com.microsoft.playwright.*;
|
import com.microsoft.playwright.*;
|
||||||
|
import com.microsoft.playwright.options.AriaRole;
|
||||||
|
|
||||||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
||||||
|
|
||||||
|
|
@ -26,7 +27,7 @@ public class App {
|
||||||
assertThat(page).hasTitle(Pattern.compile("Playwright"));
|
assertThat(page).hasTitle(Pattern.compile("Playwright"));
|
||||||
|
|
||||||
// create a locator
|
// create a locator
|
||||||
Locator getStarted = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Get Started"))
|
Locator getStarted = page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Get Started"));
|
||||||
|
|
||||||
// Expect an attribute "to be strictly equal" to the value.
|
// Expect an attribute "to be strictly equal" to the value.
|
||||||
assertThat(getStarted).hasAttribute("href", "/docs/intro");
|
assertThat(getStarted).hasAttribute("href", "/docs/intro");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue