Pytorch-NLU icon indicating copy to clipboard operation
Pytorch-NLU copied to clipboard

Support page.mainFrame().evaluateHandle('document')

Open Bnaya opened this issue 4 years ago • 5 comments

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

Bnaya avatar Oct 06 '20 23:10 Bnaya

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?

gioragutt avatar Oct 10 '20 13:10 gioragutt

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

Bnaya avatar Oct 13 '20 12:10 Bnaya

Doesn't it mean we just have to add the method names here?

gioragutt avatar Oct 13 '20 12:10 gioragutt

Yes, kinda :)

Bnaya avatar Oct 13 '20 17:10 Bnaya

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...

gioragutt avatar Oct 13 '20 18:10 gioragutt