Setting file path in file dialog box automatically by javascript

Discussion in 'JavaScript' started by suresh.char, Mar 8, 2007.

  1. #1
    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. :confused:

    Thanks & Regards

    Suresh C
     
    suresh.char, Mar 8, 2007 IP
  2. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #2
    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.
     
    Aragorn, Mar 8, 2007 IP
  3. suresh.char

    suresh.char Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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
     
    suresh.char, Mar 8, 2007 IP
  4. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #4
    That is NOT possible with JavaScript.
     
    Aragorn, Mar 9, 2007 IP
  5. serjio28

    serjio28 Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.
     
    serjio28, Mar 15, 2007 IP
    Aragorn likes this.
  6. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #6
    I'm sorry, I never thought about that. Thanks for the info :)
     
    Aragorn, Mar 16, 2007 IP
  7. serjio28

    serjio28 Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    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
     
    serjio28, Mar 16, 2007 IP
  8. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #8
    Thanks a lot, thats a really useful link :)
     
    Aragorn, Mar 17, 2007 IP
  9. gala

    gala Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Please check:
    http://www.ardentedge.com/pr_fd.htm
     
    gala, Jul 9, 2008 IP