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:
Emerson Castaneda 2023-01-05 14:05:16 -05:00 committed by GitHub
parent ef877dadfe
commit 9f7b0e4e01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ package org.example;
import java.util.regex.Pattern;
import com.microsoft.playwright.*;
import com.microsoft.playwright.options.AriaRole;
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
@ -26,7 +27,7 @@ public class App {
assertThat(page).hasTitle(Pattern.compile("Playwright"));
// 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.
assertThat(getStarted).hasAttribute("href", "/docs/intro");
@ -91,4 +92,4 @@ Page page = context.newPage();
- [Run single test, multiple tests, headed mode](./running-tests.md)
- [Generate tests with Codegen](./codegen.md)
- [See a trace of your tests](./trace-viewer-intro.md)
- [See a trace of your tests](./trace-viewer-intro.md)