selenium not setting input field value

后端 未结 1 1840
迷失自我
迷失自我 2021-01-04 03:00

Let\'s say we have this website https://www.coinichiwa.com/ which has a BET AMOUNT input box. It\'s html is:



        
相关标签:
1条回答
  • 2021-01-04 03:24

    You need to clear() the text input first:

    bet_fa = browser.find_element_by_id("betFa")
    bet_fa.clear()
    bet_fa.send_keys("0.00000005")
    

    As for the your second problem - this is an input and the value you enter into it is kept inside the value attribute, not the text. Use get_attribute() method:

    browser.find_element_by_xpath("//input[contains(@id,'betFa')]").get_attribute('value')
    
    0 讨论(0)
提交回复
热议问题