title: Handling "select from computer" button in selenium python (upload file)
body: <p>I'm trying to create an Instagram bot to post something, I am using the Selenium webdriver to achieve this. After click on 'New Post', I want to choose an image from my computer, however I don't know how to do this with the bot.</p>
  <p><img src="https://i.stack.imgur.com/E2hux.png" alt="image" /></p>
  <p>I try to find the 'Select From Computer' button and use <code>send_keys</code>, but this does not work.</p>
  <pre class="lang-js prettyprint-override"><code>def Post(self,items):
      self.driver.find_element_by_css_selector('svg[aria     label=&quot;New Post&quot;]').click()
      select_file=self.driver.find_element_by_css_selector('body &gt; div.RnEpo.gpWnf.Yx5HN &gt; div.pbNvD &gt; div &gt; div &gt; div &gt; div.uYzeu &gt; div._C8iK &gt; div &gt; div.qF0y9.Igw0E.rBNOH.YBx95._4EzTm.T9mq-.nGS-Y &gt; div.qF0y9.Igw0E.rBNOH.eGOV_.ybXk5._4EzTm.kEKum &gt; div &gt; button')
      select_file.send_keys('D:\project\python\digikala\images\download.jpg')
  
      # path=&quot;D:\\\\project\\\\python\\\\digikala\\\\images\\\\download.jpg&quot;
      # script = &quot;document.querySelector('body &gt; div.RnEpo.gpWnf.Yx5HN &gt; div.pbNvD &gt; div &gt; div &gt; div &gt; div.uYzeu &gt; div._C8iK &gt; div &gt; div.qF0y9.Igw0E.rBNOH.YBx95._4EzTm.T9mq-.nGS-Y &gt; div.qF0y9.Igw0E.rBNOH.eGOV_.ybXk5._4EzTm.kEKum &gt; div &gt; button').value='&quot; + path + &quot;';&quot;
      #self.driver.execute_script(script)
  
      for item in items:
          pass
  </code></pre>