Automatic browser selection using a file input tag through a browser extension

I want to automatically select a file through
File input tag <input type = file> via java script?

I know this is a security issue and is usually not resolved.

But whether it is allowed through extensions or in any form in any browser,

because I'm working on an automation project
which requires the publication of a form with several values, upload, which first uploads the file, and then the message form (kijiji.ca)

and it needs to be done.

it’s not necessary to be the browser of any browser that has automation capabilities such as chrome, Fire fox

Additional call forwarding

Hi Vladimir, I worked, as Vladimir suggested in the field of expansion.

Can I tell me if I need to automatically select multiple files, what value should I set.

I tried to install this

input.value = '"D:\Temp\step1.jpg" "D:\Temp\step2.jpg" "D:\Temp\step3.jpg"' 

but he does not accept it. Although I can set it to one image, and it takes it.

thanks..

0
source share
1 answer

Firefox extensions can set the input.value property, so something like this will work:

 input.value = "c:\\autoexec.bat"; input.form.submit(); 

However, when using the Add-on SDK, the contents of the script will most likely not have the necessary privileges (it is necessary to test). In this case, you will need to use the chrome authority and access the web page directly, and not through the content script.

As for Chrome, extensions there do not have access to the file system - therefore, the security restrictions that apply to web pages also apply to extensions. Allowing extensions to set the value of the file upload widget will be a security issue there. Therefore, I am sure that this is not possible.

+2
source

All Articles