title: Selenium iframe upload image
body: <p>So, I'm trying to upload image with Selenium Python. Here is what's supposed to do:</p>
  <ol>
  <li>First I click on the button
  <a href="https://i.stack.imgur.com/H7K2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H7K2a.png" alt="enter image description here" /></a></li>
  <li>It opens up a file window</li>
  <li>I choose which file I want to upload</li>
  <li>The file uploads to my website with the preview shown and a link to the image is generated on the field below
  <a href="https://i.stack.imgur.com/J4SoH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J4SoH.png" alt="enter image description here" /></a></li>
  </ol>
  <p>Here is what I got so far:</p>
  <pre><code>driver.switch_to.frame(0)
  upload_image = driver.find_element(&quot;xpath&quot;, &quot;//div[@id='drop']/input[@name='images']&quot;)
  upload_image.send_keys(&quot;C:/Users/Pictures/banner1.png&quot;)
  time.sleep(3)
  driver.switch_to.parent_frame()
  </code></pre>
  <p>When I run the script, there are no errors and I think the image successfully upload(?). But the image preview didn't display and the image link is not generated.
  <a href="https://i.stack.imgur.com/I2Vvk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I2Vvk.png" alt="enter image description here" /></a></p>
  <p>Here is the html:</p>
  <pre><code>&lt;div id=&quot;container&quot;&gt;
     &lt;section id=&quot;main-content&quot;&gt;
        &lt;form id=&quot;upload&quot;&gt;
           &lt;div id=&quot;drop&quot;&gt;
              &lt;a&gt;点击上传&lt;/a&gt;
              &lt;div class=&quot;progress invensible&quot;&gt;&lt;/div&gt;
              &lt;div class=&quot;file-types&quot;&gt;&lt;/div&gt;
              &lt;script&gt;&lt;/script&gt;
              &lt;input type=&quot;file&quot; name=&quot;images&quot; multiple&gt;
           &lt;/div&gt;
        &lt;/form&gt;
     &lt;/section&gt;
  &lt;/div&gt;
  
  </code></pre>
  <p>Any solutions?</p>