页面样式如下
<div class="css-188r068">
<div class="bn-inputCode-input">
<input data-bn-type="input" placeholder="" inputmode="numeric" pattern="[0-9]*" value="">
</div>
<div class="bn-inputCode-input">
<input data-bn-type="input" placeholder="" inputmode="numeric" pattern="[0-9]*" value="">
</div>
<div class="bn-inputCode-input">
<input data-bn-type="input" placeholder="" inputmode="numeric" pattern="[0-9]*" value="">
</div>
<div class="bn-inputCode-input">
<input data-bn-type="input" placeholder="" inputmode="numeric" pattern="[0-9]*" value="">
</div>
<div class="bn-inputCode-input">
<input data-bn-type="input" placeholder="" inputmode="numeric" pattern="[0-9]*" value="">
</div>
<div class="bn-inputCode-input">
<input data-bn-type="input" placeholder="" inputmode="numeric" pattern="[0-9]*" value="">
</div>
</div>
脚本处理如下
for (let curr = 0; curr < 6; curr++) {
cy.get('[pattern="[0-9]*"]').eq(curr).type("1{enter}")
}
网友评论