Python selenium 操作input 重新賦值


1. 再自動化測試中,經常出現input 重新賦值的情況,代碼如下:

# 引入模塊

from selenium.webdriver.common.keys import Keys

# 獲取指定的dom

singleAdd_productCode = webdriver.find_element_by_id('SingleAdd_productCode')

# 選中input 框的所有內容
singleAdd_productCode.send_keys(Keys.CONTROL+'a')

# 刪除選中的內容
singleAdd_productCode.send_keys(Keys.DELETE)

# 重新賦值
singleAdd_productCode.send_keys(outerSkuCode)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM