Upload File in a Website without Click activity

Hi,

I am trying to upload a file from my system folder to this website. Can anyone help me with this to upload file without using click and file selection window option. Its a time consuming process.
I have tried Invoke code and using vb.net I have made to download a file . So now I am looking for the same or any other activity for getting the upload Part Done. Please do help with this as its a important part of the project to save time.

HI @Kevin_Palathuruthy

You can try with HTTP request, Check out the Video

Hope it will helps

Regards
Gokul

Have u tried this , Can u elaborate this process I am not understanding the process . Will it work for my upload section?

Hey @Kevin_Palathuruthy,

This task can be done by API Post Method. Try the below vb.net code, I have not tried it but I think it will work

    Dim client As WebClient = New WebClient()
    Dim myFile As String = "D:\test_file.txt"
    client.Credentials = CredentialCache.DefaultCredentials
    client.UploadFile("http://localhost/uploads/upload.php", "POST", myFile)
    client.Dispose()

Thanks,
Sanjit

Hello @Kevin_Palathuruthy

Usually in selenium we have an option to upload the file by just providing the path of the file to the input element in the webpage. SO instead of click it will automaticallly load the file.

can you inspect and check whether any element with is present. Then maybe we can try with vb.net also.

Thanks

My website is a government website . Where I am not getting the URL to post . I have been provided only the options to upload . Is there any way to get URL of the government website/.

image

image
This are the elements that is been shown while checking the inspect can u please check , and try to get the code.

just upload any file in that and than try to check the element.


Uploaded a .png file and got this.

For this case better if you will do the UiAutomation it won’t take much time.

Ui automation I have done with click and selecting the file from pop up for file selection window. But its taking much Time . I need to complete this whole process which includes a data entry Part within 30 sec