We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ElementHandle
document.body
document
1 parent 93f3d1c commit e5b3e6fCopy full SHA for e5b3e6f
lib/index.ts
@@ -157,9 +157,11 @@ function createDelegateFor<T = DOMReturnType>(
157
export async function getDocument(_page?: Page): Promise<ElementHandle> {
158
// @ts-ignore
159
const page: Page = _page || this
160
- const documentHandle = await page.mainFrame().evaluateHandle('document')
+ const documentHandle = await page.mainFrame().evaluateHandle<HTMLElement>('document.body')
161
const document = documentHandle.asElement()
162
+
163
if (!document) throw new Error('Could not find document')
164
165
return document
166
}
167
0 commit comments