How to upload file ( picture ) with selenium, python


is there any possibility how to upload on web picture with selenium testing tool ? I am using python.

I tryed many things, but nothing didnt work. I am desperate.

Upload looks like this :

Thank you for your help


  • You must to post comments

Upload input control opens a native dialog (it is done by browser) so clicking on the control or browse button via Selenium will just pop the dialog and the test will hang.

The workaround is to set the value of the upload input via JavaScript (in Java it is done via JavascriptExecutor) and then submit the form.

See this question for sample in C#, I am sure there’s also a way to call JavaScript in Python but I never used Selenium Python bindings

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.