Hi, We are developing one automation testing tool. There, we have one requirement in which we have to automatically open file dialog box, set the file path( user input) and click open button in the file dialog box for <input type=file> element. Is it possible to set automatically the file name which is given by user through XL Sheet file to the File name text field of File Dialog box as well as click the open button of File Dialog box using javascript? Please if any body is having idea about this, let me know. Thanks & Regards Suresh C
I don't think it is possible. Becoz if such a facility is available, then it will be easy for malicious websites to steal private information from your system. All they have to do is insert a file input field prefilled with the path to an important file on your computer, and automatically submit the form.
Hi, Thanks for your great reply regarding my doubt. User (Tester) will know about the local system directory's file name. He will give the file path in the XL sheet. My tool will take the input as well as run the AUT(Application Under Test). There, My tool automatically has to click the browse button, set the user input(file path) and click save/open button of the file dialog box of the application. Automatically click the browser button, we have script to do this task. But once file dialog box is opened, we want to set user input in the file path text field as well as click the save/open button using javascript function. Is there any javascript available to do this operation? The above scenario is for the web application which is having file upload functionality. Thanks Suresh C
For me it can be done but under Mozilla/Firefox only. But you should write a special extension/addon for this. Being installed the extension/addon has access to all facilities of your browser and filesystem. Have a look to the extension developers area under Firefox/Mozilla browsers.
I found these tools for myself few months ago. And I still under impression of power that can give you extension/addons development under Firefox/Mozilla. Please take a visit at below link. There are a lot of materials which can help you to start . kb dot mozillazine dot org / Extension_development