let table = document.querySelector('form[action="mtr1010.asp"] table:nth-of-type(2)');
ReferenceError: document is not defined
puppeteerのスクリプト内でDOM要素の取得がしたい場合
直接document.querySelector()では取得できない。
下記のように page.evaluate()経由で取得する。
page.evaluate(pageFunction[, ...args])
const bodyHandle = await page.$('body');
const html = await page.evaluate(body => body.innerHTML, bodyHandle);
await bodyHandle.dispose();