Let us know what functionality you'd like to see in Playwright and what your use case is.
Do you think others might benefit from this as well?
My use case are page fragments that receive root locator from the main page, and use it as a reference point for further element interactions. And sometimes I need an instance of the page used to define the root locator. So it would be a bit easier to get the instance from the locator, than passing it as additional constructor argument.
What I'm doing now
export class SomeFragment {
constructor(private page: Page, private root: Locator) {}
async someMethod() {
await this.page.doSomeWork()
}
}
What I would like to do
export class SomeFragment {
constructor(private root: Locator) {}
async someMethod() {
this.root.page.doSomeWork()
}
}
Let us know what functionality you'd like to see in Playwright and what your use case is.
Do you think others might benefit from this as well?
My use case are page fragments that receive root locator from the main page, and use it as a reference point for further element interactions. And sometimes I need an instance of the page used to define the root locator. So it would be a bit easier to get the instance from the locator, than passing it as additional constructor argument.
What I'm doing now
What I would like to do