title: Upload a file using selenium webdriver WITHOUT using Robot API or selenium command send keys
body: <p>I have a web application which is using Outsystem for UI. So the File upload button is of Type = 'submit' and not Type='file' hence the selenium code</p>
  
  <pre><code>    driver.findElement(By.id("browse")).sendKeys("/path/to/the/file");
  </code></pre>
  
  <p>used to upload a file is not working for me. I have tried the code for Robot API as well</p>
  
  <pre><code>WebElement ele = driver.findElement(By.id("Browse"));
  ele.click();    
  StringSelection ss = new StringSelection(FilePath); 
  Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);                                     
  Robot robot = new Robot();
  robot.keyPress(KeyEvent.VK_CONTROL);
  robot.keyPress(KeyEvent.VK_V);
  robot.keyRelease(KeyEvent.VK_V);
  robot.keyRelease(KeyEvent.VK_CONTROL);
  Thread.sleep(500);
  robot.keyPress(KeyEvent.VK_ENTER);
  robot.keyRelease(KeyEvent.VK_ENTER);    
  </code></pre>
  
  <p>Which is sometimes working fine , but failing most of the time because the focus is removed from the window. My Script will run for a long time, in such scenario keeping the focus always on the window is not a feasible idea. Can someone suggest me any other way to tackle the upload file process in Selenium? </p>