美文网首页
Cypress 验证码输入框处理

Cypress 验证码输入框处理

作者: BestFei | 来源:发表于2020-06-09 20:01 被阅读0次

    页面样式如下


    <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}")
        }
    

    相关文章

      网友评论

          本文标题:Cypress 验证码输入框处理

          本文链接:https://www.haomeiwen.com/subject/twvetktx.html