title: Change the value of Input field and press enter using python and selenium
body: <p>I am trying to collect some information from a web page by changing the value of an input field. But every time I change the value, the webpage <strong>automatically changes</strong> the value of the input box back to the default value. Here is the implementation:</p>
  <pre><code>driver = webdriver.Chrome()
  page = driver.get(&quot;https://www.edmunds.com/cars-for-sale-by-owner/&quot;)
  
  inputElement = driver.find_element_by_name(&quot;zip&quot;)
  inputElement.clear()
  inputElement = driver.find_element_by_name(&quot;zip&quot;)
  inputElement.send_keys('23835')
  inputElement.send_keys(Keys.ENTER)
  </code></pre>
  <p>How can I change the value and press enter to get the filtered webpage?</p>
  <p><strong>Update!! Solution:</strong>
  Change the value to null by <code>driver.execute_script(&quot;arguments[0].setAttribute('value','')&quot;,inputElement)</code> , then write other logic to send keys. It did not work at first, but now Its working though.</p>
  <pre><code>def enter_value(zipcode):
      inputElement = driver.find_element_by_name(&quot;zip&quot;)
      driver.execute_script(&quot;arguments[0].setAttribute('value','')&quot;,inputElement)
      print(inputElement.get_attribute('value'))
      inputElement.clear()
      inputElement.send_keys(zipcode)
      inputElement.send_keys(Keys.ENTER)
  
  driver = webdriver.Chrome()
  drive = driver.get(&quot;https://www.edmunds.com/cars-for-sale-by-owner/&quot;)
  WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.NAME, 'zip')))
  
  enter_value(zipcode=&quot;23831&quot;)
  </code></pre>