2

I am using webdriver to login into a website at the moment. There is a table search which already have a digit "50" in it. I want to change it to "300".

Code snippet:

no="300"
blank = driver.find_element_by_id("PC1_PageSize")
blank.send_keys(no)

But when I tried this, it became "50300". My expected result is to replace "50" to "300". Thanks in advance!

Mahesh Karia
  • 2,045
  • 1
  • 12
  • 23
Lara19
  • 615
  • 1
  • 9
  • 20

1 Answers1

5

If you want to write new value into input field instead of appending it, you should call clear() before send_keys():

no="300"
blank = driver.find_element_by_id("PC1_PageSize")
blank.clear()
blank.send_keys(no)
Andersson
  • 51,635
  • 17
  • 77
  • 129