1
0
mirror of synced 2026-08-06 07:26:55 +00:00

fix: implement LocatorImpl.getByRole (#1131)

This commit is contained in:
Yury Semikhatsky
2022-11-28 14:48:32 -08:00
committed by GitHub
parent 8904de9bb8
commit afa20b91ae
2 changed files with 9 additions and 1 deletions
@@ -245,7 +245,7 @@ class LocatorImpl implements Locator {
@Override
public Locator getByRole(AriaRole role, GetByRoleOptions options) {
return null;
return locator(getByRoleSelector(role, options));
}
@Override
@@ -171,4 +171,12 @@ public class TestSelectorsGetBy extends TestBase {
asList("<a href=\"https://playwright.dev\">he llo 56</a>"),
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(" he \n llo 56 ").setExact(true)).evaluateAll("els => els.map(e => e.outerHTML)"));
}
@Test
void locatorGetByRole() {
page.setContent("<div><button>Click me</button></div>");
assertEquals(
asList("<button>Click me</button>"),
page.locator("div").getByRole(AriaRole.BUTTON).evaluateAll("els => els.map(e => e.outerHTML)"));
}
}