Q:

Selenium - input four digit numbers in input field changes five digit numbers

my code is like this 
item = ['tea', '5200']

driver.find_element_by_xpath(<path of the field>).send_keys(item[0])
driver.find_element_by_xpath(<path of the field>).send_keys(item[1])

when I run the code, the name of the item(item[0]) is completely work.
but the price of the item(item[1]) has some problem.
The default value of the price field is 0 and it changes into 05200 after I run the code.
I tried both int and str type and both has same problems.

A:

You need to clear the input box first.
Try this:
item = ['tea', '5200']

driver.find_element_by_xpath(<path of the field>).send_keys(item[0])
element1 = driver.find_element_by_xpath(<path of the field>)
element1.clear()
element1.send_keys(item[1])

Hope this helps!

