title: Python selenium: Unable to locate the element (//input[@type='file']')
body: <p>I am trying to upload a file using python automation.
  While I try to execute the code below python selenium throws an error.
  Even I tried waiting for 10 seconds to avoid synchronisation issues.</p>
  
  <pre><code>driver.execute_script('window.open("https://ocr.space/" , "new window")')
  Imagepath = r"C:\User\Desktop\banner.png"
  field=driver.find_element_by_xpath('//input[@type="file"]')
  field.send_keys(Imagepath)
  </code></pre>
  
  <blockquote>
    <p>NoSuchElementException: Message: no such element: Unable to locate
    element: {"method":"xpath","selector":"//input[@type="file"]"}</p>
  </blockquote>
  
  <p>Website url: </p>
  
  <blockquote>
    <p><a href="https://ocr.space/" rel="nofollow noreferrer">https://ocr.space/</a></p>
  </blockquote>
  
  <p>HTML snippet:</p>
  
  <pre><code>&lt;div class="span8"&gt;
    &lt;input type="file" id="imageFile" class="form-control choose valid"&gt;
  &lt;/div&gt;
  </code></pre>