【发布时间】:2021-06-06 05:00:17
【问题描述】:
这个nodeJs登录后使用Puppeteer填充一个多页面的在线网站。其中一个页面有一个输入图像可供点击,但无法使用下面的代码点击它。请说明正确点击输入元素的原因和方法。
//server/main.js
let submitLink = await page.$('input[src="/is/images/submitBtn.gif"]') //also tried page.$('input[src=/is/images/submitBtn.gif]')
await submitLink.click()
Error:
UnhandledPromiseRejectionWarning: Error: Node is either not visible or not an HTMLElement
W20210606-15:29:14.995(10)? (STDERR) at ElementHandle._clickablePoint
<!-- here is the XPATH -->
<input type="image" name="action" src="/is/images/submitBtn.gif" value="submit" tabindex="7" title="submit" alt="submit">
也试过page.click(<selector>)无济于事,这里是选择器。
body > table > tbody > tr:nth-child(3) > td:nth-child(2) > table > tbody > tr > td > form > table > tbody > tr > td > table > tbody > tr:nth-child(10) > td > table > tbody > tr:nth-child(4) > td:nth-child(1) > input[type=image]
【问题讨论】:
标签: javascript jquery puppeteer