PowerShell: write value in a input type=file Form.


I have a input type=text inputboxes on a webpage I load and fill with values and click the submit button which works fine:

I’d also like to populate a input type=file box with c:\temp\test.txt and upload this.
I read that because of security reasons the value= is not supported from the browsers.

Is there any workaround to do this with PowerShell?
Maybe “click” the browse button and select the file or use sendkeys?


Check Jaykul’s post. He uses Watin for automation. Just download the assembly and try. I was able to set the value and then submit the form like this:

I understand your reasons to use IE instead of WebClient and similar classes, however use them in other cases if possible.


In case you don’t have ID of the element, but only the name, you can try



PowerShell: write value in a input type=file Form. by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply