Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @

Select files from a dialogue OUTSIDE of the browser

TSheeleyTSheeley Members
edited November -1 in Sahi - Open Source
We have a content management app where if you click on the "Add files" button, it opens a SYSTEM dialogue (Linux) where the user can choose files from a directory tree. As this is a system dialogue and NOT a browser dialogue, SAHI does NOT recognize it. I need to be able to select files from a dialogue OUTSIDE of the browser or maybe use key presses to navigate to the files I want.

I have attempted to use _setFile and _keyPress in order to access the files in this dialogue, but it never works. Our app does allow for drag and drop, but I am NOT able to record this as the images are NOT in a browser. Can anyone help?

Linux Ubuntu
FireFox 14.0.1
Sahi Build 2011-07-19


  • I am facing the same problem. I also need the solution of this problem. I want to drag something into some file to make a scenario.

    windows 7
    Chrome 25.0.02
  • bump
  • Hi TSheeley,
    You can try using _setFile with native events.
    Check the following link out and let me know if it helps you.

  • Hello Pratyush,

    I have tried this and setFile2. Although Sahi reports this as "Playback: SUCCESS--". The files are NEVER uploaded.
  • Hello Pratyush,

    I have tried this and setFile2. Although Sahi reports this as "Playback: SUCCESS--". The files are NEVER uploaded.
  • Bump
  • Hello Pratyush_Tyto,

    I have downloaded, installed and tried using Sahi Pro. It does the same thing as the open source version. It reports: Playback: SUCCESS--, but the files are NOT uploaded. I do NOT believe this functionality works in either version.
  • Hi TSheeley,
    Is it possible for you to provide us with the webpage you're running the script and and a sample script to reproduce your problem?

  • TSheeleyTSheeley Members
    edited August 2013
    Hello Pratyush_Tyto,

    It's an internal webpage, so I cannot provide this to you. The application uploads files to a "Gallery". The files can be added via drag and drop, or there is an "Add Files" button which opens a SYSTEM dialogue (not accessible via sahi) to search the directorys. A sample of the code would be:

    for (var $j = 1; $j<14; $j++){


    _setFile(_listItem("Drag files here."), "scripts/Data/PromptsAssets/test" + $j + ".png");

    _assert(_isVisible(_span("test" + $j + ".png")));


    I have tried this using setFile2, and I have tried both setFile and setFile2 using all of the Accessor alternatives such as:

    Sahi reports this as "Playback: SUCCESS--". But the files are NEVER uploaded.

    We run this from a Linux environment and from the console for each of the files I am trying to upload, I can see:

    url: https://management-ui/messaging/prompts
    command: FileUpload_appendFiles

    The url is definitely correct.
  • Any update on this? I am facing similar issue with setFile2.

    I am able to see that the file on the text box where file path has to be mentioned. but, on commit, nothing is happening.

    In FireFox, on clicking commit, i am able to see some warning using Firebug like -- The character encoding declaration of document was found too late for it to take effect. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.

    Is there an alternative to do this? or any bug in setFile2?

Sign In or Register to comment.