【发布时间】:2020-01-01 14:00:12
【问题描述】:
所以有一种输入是这样的形式
<input class="input _ngcontent-EXCHANGE-32" focusableelement="" aria-invalid="false" aria-labelledby="930C5093-F4DD-4A01-BD2E-96F2873C8559--0" aria-disabled="false" tabindex="0" type="money64">
所以有两个像上面这样的输入。我想将第一个输入的值更改为 X,将第二个输入的值更改为 Y。
await page.$eval('input[type=money64]', el => el.value = 'X');
await page.$eval('input[type=money64]', el => el.value = 'Y');
上面的代码首先将相同输入的值更改为 X,然后更改为 Y,第二个输入保持不变。那么如何使用 puppeteer 设置第二个输入类型 = money64 的值。
【问题讨论】:
-
你可以使用 :nth-child
-
谢谢@AmanGupta,你能帮我写代码或写我可以使用的代码吗?我刚刚开始 node 和 puppeteer
-
你能提供HTML结构吗?这些输入的父级是否还有其他子级?
-
-
标签: node.js automation automated-tests google-chrome-devtools puppeteer