Fixes https://github.com/microsoft/playwright-java/issues/1130
This commit is contained in:
@@ -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)"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user