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 automate File Upload at page with jQuery ?

ZdolbekZdolbek Members
edited July 2013 in Sahi - Open Source
Most of cases Sahi is a great tool for testing and automating. But when I try to record action to add files at blueimp jquery widget for file uploading demo page ( http://blueimp.github.io/jQuery-File-Upload/
) I receive nothing. My question: is it a way to automate file uploading at pages that use such widget? For example, what script is needed to start upload file c:/text.txt to http://blueimp.github.io/jQuery-File-Upload/?

Answers

  • gaveyomgaveyom Members
    Hi Zdolbek,

    Following is the code to upload files
    
    _setFile(_file("files[]"), "D:/a.txt");
       // Change the "type" attribute of file field
    if (_isIE()){
    	_call(_file("files[]").outerHTML = _file("files[]").outerHTML.replace(/type=file/, "type=text"));
    }else{
    	_call(_file("files[]").type = "text");
    }
    	// Set the value into the textbox
    _setValue(_textbox("files[]"), "D:/a.txt");
    _click(_submit("Start upload"));
    
    
  • hi gaveyom,

    WOuld you know the difference between using _setFile different with _setFile2 ??
  • ZdolbekZdolbek Members
    Thank you for help, its work fine. I read this topic from documentation many times early, but cant understood how it can be used in that case.
This discussion has been closed.