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.

Upload Image

kaverikeerkaverikeer Members
edited December 2012 in Sahi - Open Source
Hi,
I am not able to upload Image through Sahi. I tried all suggestion which are posted, but no luck.. Is there anyother way to upload Image file. Itried below code-_setFile(_file("attachmentPhoto"),"C:\\Data\\Candidate_1.jpg");
_call(_file("filename").type = "text"); //here change file type to 'text'
_setValue(_textbox("attachmentPhoto"), "C:\\Data\\Candidate_1.jpg");
_click(_button("Upload"));
but getting messahe "Please select File" file is not uploaded, even itried to pass third parameter, no luck

Answers

  • Hi kaverikeer,

    Is your site in public so, we can test your code where it went wrong?

    Thanks.
  • Hi Kaverikeer,

    Try giving your path like "C:/Data/Candidate_1.jpg"

    SAMPLE SCRIPT:-

    _navigateTo("http://www.imagetoo.com/";);
    _setFile(_file("fileup"), "C:/Documents and Settings/umashankar/Watch_Mailbox.JPG");
    _setValue(_file("fileup"), "C:/Documents and Settings/umashankar/Watch_Mailbox.JPG");
    _click(_imageSubmitButton("subir"));

    For more detail:-

    Refer:- http://sahi.co.in/w/_setfile

    Please do let me know if you have any questions.
    Good Luck!!
  • Tried, but no luck. FYI- Text field is read only means need to browse photo, i guess due to this setValue is not working....
Sign In or Register to comment.