(Python) Upload a file via 'Browse' window Selenium
<p>For testing purposes, I need to</p>

<ol>
<li>Choose a file via the Browse window (<a href="http://i.stack.imgur.com/pQ1lS.png" rel="nofollow">See screenshot here</a>)</li>
<li>Click on 'Open' (to upload the file to the website) and then </li>
<li>Click on "Upload".</li>
</ol>

<p>How do I do that via selenium? 'cause the following did not work:</p>

<pre><code># hident2 is the name of "Choose File" element
wd.find_element(By.XPATH("//input[@id='hident2']")).sendKeys("C:\\Users\\file-to-upload.xml"); 

# input.btn.primary is the name of "Upload" button element**
wd.find_element_by_css_selector("input.btn.primary").click()
</code></pre>

<p>I get the following error: </p>

<blockquote>
  <p>TypeError: 'str' object is not callable</p>
</blockquote>

<p>What am I doing wrong?</p>