title: How to deal with file uploading in test automation using selenium or webdriver
body: <p>I think that everybody who uses Webdriver for test automation must be aware of its great advantages for web development.</p>
  <p>But there is a huge issue if file uploading is part of your web flow. It stops being test automation. The security restriction of browsers (invoking file selection) practically makes it impossible to automate tests.</p>
  <p>Afaik the only option is to have Webdriver click the file upload button, sleep the thread, have developer/tester manually select the file, and then do the rest of the web flow.</p>
  <p>How to deal with this, is there a workaround for it? Because it really can't be done like this. It wouldn't make sense.</p>
  <p>This is the only case I know of when browser security restrictions do not apply:</p>
  <pre><code>&lt;script language=javascript&gt;   
    function window.onload(){   
            document.all.attachment.focus();   
            var WshShell=new ActiveXObject(&quot;WScript.Shell&quot;)   
            WshShell.sendKeys(&quot;D:\MyFile.doc&quot;)
    }   
  &lt;/script&gt;
  </code></pre>