18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to record pop up file browser window?

siv_swarsiv_swar Members
edited November -1 in Sahi - Open Source
Hi narayan,

I m new to Sahi, but understood the basics well. i m testing a web application developed in php and when i tried recording a pop file browser window, it would not records that part. I tried using _popup() API, but couldn't figure out how to select a file from the list displayed. Pls help me out in this issue.

Thanks In advance,
Siva

Comments

  • narayannarayan Administrators
    Hi Siva, have a look at http://sahi.co.in/w/_setFile
  • siv_swarsiv_swar Members
    edited March 2011
    hi narayan,

    i went thru the link and even tried with the sample code u provided, but the solution just changes the field type from "file_upload" to "text" and on uploading, the web application does not recognizes the upload field, as the field type has been changed. Whereas when i try the same scenario manually, it works fine. pls help me with this issue.

    Note: the _setFile(), works well as it puts the given file path without any issues.

    Let me brief the scenario,

    1. The php page has a field with the type "upload_file".
    2. On clicking the browse button or on just clicking on that field, Will open a "file browser" to select the desired file.
    3. the user will browse and select the file and click on Open.
    4. On clicking the Upload button, the selected file will be uploaded to the DB.

    Now, the Sahi understands the Step 1 and 4, but not the Step 2 and 3, pls give me some solution...

    I hope the details are clear, if not pls reply me as soon as possible..

    Thanks in advance
    Siva
  • PravinPravin Members
    Siva/Nari : Any solution for this problem.
  • narayannarayan Administrators
    1) Look to see if there are any exceptions on the Sahi console (the command prompt). If it shows any FileNotFoundException, correct the path of your file.

    2) Check if the URL to which the form is being submitted is correct. Sometimes the URL is changed when the form is submitted, and Sahi needs to be told about it using the 3rd parameter in _setFile
  • narayannarayan Administrators
    Hey PM,

    Nahin chala to email kar. narayan@sahi.co.in

    Cheers!
  • I have the similar problem, base on the code
    _setFile(_file("file_0"), "D:\\sahi\\userdata\\User Guide.docx");
    _call(_file("file_0").type = "text");
    _setValue(_textbox("file_0"), "User Guide.docx");

    the file path is set on the text box, but when i upload, it always prompt to select a file first. by the way, we have ajax in this page. could you give me answer?
  • TheeranTheeran Members
    edited November 2011
    Hi herseeing,

    Send the source code and script to http://support@sahi.co.in.let we work on it.

    Regards
    Theeran.
Sign In or Register to comment.