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.

File upload issues for GWT App

RamRam Members
edited November -1 in Sahi - Open Source
The GWT application has an upload file feature, The user has to select the browse button, select the file from the windows file selection dialog. After selecting the file, we would need to submit the record to complete the functionality

When using Sahi, we applied this workaround, by converting the file type, since there are validations

_setFile(_file("File"), "scripts\\demo\\uploadme.txt");
_call(_file("File").type= "text");
_setValue(_textbox("File"), "scripts\\demo\\uploadme.txt");

Though the file gets uploaded, on submission of the record, it indicates that the file format is incorrect.

Kindly let us know if there is other way of uploading files, Like handling the Windows file dialog through which files can be uploaded.

Comments

  • Hi Ram,

    It seems like there is some sort of validation is happening.

    Please go through the following link,

    http://sahi.co.in/forums/viewtopic.php?id=1647

    This might help you.

    Regards,
    Theeran.
  • RamRam Members
    Hi Theeran,

    Thank you for your quick response.
    I'm converting the file to text box, after entering the file path again I am converting to file.
    But when I am submitting the form the file which i uploaded is not reflecting in preview.
    I'm looking forward for how to handle windows file upload window.


    It seems like there is some sort of validation is happening.

    Please go through the following link,

    //sahi.co.in/forums/viewtopic.php?id=1647

    This might help you.

    Regards,
    Theeran.
  • Hi Ram,

    Why you need to convert back the file type from text to file. This workaround involves only the programmatic conversion and doesnt involve actual webpage html modification.

    The Programmatic conversion of element type from file to text is to pass the form validation only.

    Once you refresh the page, the file element will be of type file and not text.

    Try without converting back text to file.

    Regards,
    Theeran.
  • RamRam Members
    Hi Theeran,

    If i do not convert the text type to file type, form is not getting submitted.
    Is there any way to handle windows file dialog with sahi?
    I tried to handle as popup window but it's not working.


    I'm able to click on any object in application, but i'm not able to click on "Browse..." button to select the file from windows file dialog.

    Regards,
    Ram.
Sign In or Register to comment.