我有一個 puppeteer 刮刀,我必須插入信用卡資訊。我訪問 Cvv 和 Expire 欄位沒有問題,但我無法輸入 cc number 欄位。
iframe 中的輸入檔案就像這樣
<iframe src="bla bla bla my url" scrolling="no" name="FrameCCPay" id="FrameCCPay" frameborder="0" allowtransparency="true" style="width: 100px; height: 18px; border: none; margin: 0px; padding: 0px; min-width: 100%; overflow: hidden;"></iframe>
在框架的檔案中有這個代碼
<div class="placePan">
<div class="input-container">
<input type="tel" autocomplete="off" spellcheck="false" name="482e7f7b-59aa-3f0d-bde7-8dcf6bcee7a7" class="cleavePan hasError" id="482e7f7b-59aa-3f0d-bde7-8dcf6bcee7a7" maxlength="24" placeholder="Numero Carta" style="display: inline-block;">
<input type="tel" autocomplete="off" spellcheck="false" class="cleavePan" id="482e7f7b-59aa-3f0d-bde7-8dcf6bcee7a7_bin" maxlength="24" placeholder="Numero Carta" style="display: none;">
</div>
</div>
我的木偶代碼
const frame = getFrame(this.page, "FrameCCPay")
await frame.waitForSelector(".placePan input")
await frame.focus('.placePan input')
await frame.type(".placePan input", mynumber)
這段代碼適用于我所說的另一個歸檔,并且歸檔 ae 以相同的方式完成。唯一的區別是 cc umber 有兩個輸入相同的類(.placePan 輸入),所以我認為這是問題所在。
我可以在正確的輸入型別中使用 TYPE 函式嗎?我如何排除隱藏的.placePan 輸入?
uj5u.com熱心網友回復:
請問這是干什么用的?@用戶14012602
uj5u.com熱心網友回復:
如果您認為問題在于隱藏輸入,請使用僅在所需輸入中具有屬性的選擇器:".placePan input[name]"。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/341320.html
標籤:javascript 傀儡师
上一篇:在一個if內執行多個動作
