await page.evaluate(() => { window.scrollBy(0, window.innerHeight); }) jest.setTimeout(20000) await page.click('#ApplyBthNAP, #btnCheck');
<iframe id="frameContent" frameborder="0" height="100%" marginheight="0" marginwidth="0" scrolling="no" width="100%" src="html/status/wlaninfo.asp" style="height: 585px;"></iframe> <div id="ApplyBthNAP"> <span class="tabal_head"> <script> document.write(status_wlaninfo_language['amp_napinfo_title']); </script> Neighboring AP Information </span> <input style="margin-left:25px;" name="btnCheck" class="submit" id="btnCheck" type="button" value="Query"> <script> document.getElementsByName('btnCheck')[1].value = status_wlaninfo_language['amp_stainfo_query']; </script> </div>
The error i keep getting is FAIL test\\header.test.js (24.613s) × Click and check url (23238ms)
● Click and check url
TypeError: Cannot read property 'click' of null
at Page.click (node_modules/puppeteer/lib/Page.js:816:18)
console.assert node_modules\\puppeteer\\lib\\Page.js:815 AssertionError [ERR_ASSERTION]: No node found for selector: #ApplyBthNAP, #btnCheck
Test Suites: 1 failed, 1 total
After a few research i got to know that puppeteer has some bug associated with IFrames. Requirement is to press a button with Value='Query' The only problem with normal selector method it is showing null. Please enlighten me. Thanks in advance
也许您是说('#ApplyBthNAP #btnCheck')
而不是('#ApplyBthNAP, #btnCheck')
在 div中查找按钮,而不是按钮和 div?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.