Cypress 验证码输入框处理

2020-06-09  本文已影响0人  BestFei

页面样式如下


<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}")
    }
上一篇下一篇

猜你喜欢

热点阅读