Pytorch-NLU
Pytorch-NLU copied to clipboard
Support page.mainFrame().evaluateHandle('document')
Calls to page.mainFrame()
and Element handles acquired by frames, are not instrumented
As in use in: https://github.com/hoverinc/playwright-testing-library/blob/master/lib/index.ts#L147-L153
Copied for convenience.
export async function getDocument(_page?: Page): Promise<ElementHandle> {
// @ts-ignore
const page: Page = _page || this
const documentHandle = await page.mainFrame().evaluateHandle('document')
const document = documentHandle.asElement()
if (!document) throw new Error('Could not find document')
return document
}
@Bnaya How do you imagine this being instrumented? what would be the outcome?
I think that if we wrap mainFrame, frames and evaluateHandle can do we need to make sure puppeteer and playwright compat https://github.com/puppeteer/puppeteer/blob/3afe1935da5ee3b3a3ed8e910dd8dc280a0ae094/src/common/Page.ts The important outcome would be to have the operations on the element handles recored, the calls to mainFrame/frames are not very interesting i think
Doesn't it mean we just have to add the method names here?
Yes, kinda :)
Oh and also, since you're using Frame#evaluateHandle
, you'd have to add either text mapping and/or selector mapping, depending on what input it can get...