title: Python Selenium: How to get text generated by JavaScript in input field
body: <p>I have a problem in getting text from user name field in one of the forms on my webpage using Python &amp; Selenium.</p>
  
  <p>I have a field that is populated by JS after selecting a User from a list:</p>
  
  <pre><code>&lt;select id="users" onchange="checkUser(document.getElementById('configpin'))" ondblclick="document.getElementById('users').size=1; showUser(document.getElementById('configpin'))" onmouseout="document.getElementById('users').size=1" size="1"&gt;&lt;option value="1"&gt;1 User 1&lt;/option&gt;[...]&lt;/option&gt;&lt;/select&gt;
  </code></pre>
  
  <p>The field:</p>
  
  <pre><code>&lt;input name="name1" value="" type="text" id="name1" onkeyup="checkNameEntry('name1',20)" onchange="checkNameEntry('name1',20)" onkeydown="if(event.keyCode == 13) submitUser(document.getElementById('configpin'));"&gt;
  </code></pre>
  
  <p>And I am trying to get the text displayed in that field, but it does not work.
  I was trying:</p>
  
  <pre><code>uname = driver.find_element_by_id('name1').get_attribute('innerHTML')
  </code></pre>
  
  <p>AND:</p>
  
  <pre><code>uname = driver.find_element_by_id('name1').text
  </code></pre>
  
  <p>but in both cases, all I get from it is an empty string. I expect this is a common problem and should have some obvious solution, but I can't find it.</p>