Having trouble navigating file explorer with python
<p>I am building an automated browser with selenium and it is working flawlessly! (thank you selenium (: )
But I am having trouble uploading a file. One of the steps I need to execute is to upload a file.</p>

<p>The code I use to upload, and seems like it works for many people, is:</p>

<pre><code>file_input = driver.find_element_by_id('ImageUploadButton')
file_input.send_keys('C:\\image.jpg')
</code></pre>

<p>Also tried:</p>

<pre><code>driver.find_element_by_id('ImageUploadButton').click()
driver.find_element_by_css_selector('input[type="file"]').clear()
driver.find_element_by_css_selector('input[type="file"]').send_keys('C:\\image.jpg')
</code></pre>

<p>This seems to work for a lot of people, but for me, it just opens the file explorer for me to pick the file I want to upload, and that is it. No error message, just continues to execute the code.</p>

<p>Is anyone aware of maybe another module that I can use to navigate the file explorer and submit the file?</p>

<p>Or am I using selenium inappropriately? </p>

<p>----------- edit ---------------</p>

<p>Added DIV from website:</p>

<pre><code>    &lt;div id="FileInputWrapper" class="file-input-wrapper"&gt;
    &lt;input id="FileUploadInput" type="hidden" name="file"&gt;
    &lt;button id="ImageUploadButton" class="button-update-cancel short file-upload-button" type="button" style="position: relative; z-index: 1;"&gt; Select Images&lt;/button&gt;
    &lt;/div&gt;
&lt;input type="hidden" name="images"&gt;
&lt;div id="html5_1auv7g94u187l1qdq108d1ue5qve3_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 518px; left: 0px; width: 155px; height: 45px; overflow: hidden; z-index: 0;"&gt;
&lt;input id="html5_1auv7g94u187l1qdq108d1ue5qve3" type="file" accept="image/jpeg,image/png,image/gif,image/bmp" multiple="" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;"&gt;
&lt;/div&gt;
</code></pre>

<p>Seems that you use wrong locator to upload file. You should handle <code>input</code> element, not <code>button</code>:</p>

<pre><code>file_input = driver.find_element_by_xpath('//input[@type="file"]')
file_input.send_keys('C:\\image.jpg')
</code></pre>

python selenium