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 not happening in IE...

SushilSushil Members
edited June 2013 in Sahi - Open Source
Sahi- V3.5/ V-4.4
OS - Windows 7
IE - IE 8/9

Hi All,

FIle upload in IE is not working. Please find below properties from sahi controller of the file field:

outerHTML=<INPUT class=file onchange="setFileNameFromPath(this.value, document.forms[0].filename);" type=file name=fileIndex1>;
clientLeft=1;
all={{[object]}};
all=[object];
maxLength=2147483647;
loop=1;
form={{[object]}};
form=[object];
start=fileopen;
size=20;
type=file;
name=fileIndex1;

After converting the file field to text field using code-

_setSelected(_select("docTypeId_fileIndex1"), "Document");
_call(_file("file").outerHTML=_file("file").outerHTML.replace(/type=file/,"type=text"));
//even tried this:_call(_file("fileIndex1").outerHTML=_file("fileIndex1").outerHTML.replace(/type=?fileIndex1?/, "type=text"));
setValue(_textbox("file"), "D:\\FulfillmentCase.pdf");

but it did not work and the properties after changing it to text field :

outerHTML=<INPUT class=file onchange="setFileNameFromPath(this.value, document.forms[0].filename);" value=D:\\FulfillmentCase.pdf name=fileIndex1>;
clientLeft=2;
all={{[object]}};
all=[object];
value=D:\FulfillmentCase.pdf;
type=text;
name=fileIndex1;

But same in other browsers are working with :_call(_file("fileIndex1").type="text");

Please help with any workarounds for this, not able to find out if its problem related to the way our functionality is designed or any change needed with sahi.

Regards,
Sushil

Comments

  • Hi,

    We tried the same using Sahi Pro trial version, even there no results.

    Any suggestions?

    Regards,
    Bhavitha
  • gaveyomgaveyom Members
    Hi,

    try this
    
    _setFile(_file("SourceFileUpload"), "D:/txtfile.txt");
       // Change the "type" attribute of file field
    if (_isIE()){
    	_call(_file("SourceFileUpload").outerHTML = _file("SourceFileUpload").outerHTML.replace(/type=file/, "type=text"));
    }else{
    	_call(_file("SourceFileUpload").type = "text");
    }
    	// Set the value into the textbox
    _setValue(_textbox("SourceFileUpload"), "D:/txtfile.txt");
    
    
  • SushilSushil Members
    Hi,

    Its too late for a response.My apologies. But still the solution not working in Sahi OS. Please look i to this and provide some working solutions as am stuck in my major automation activities.

    Thanks,

    Sushil
Sign In or Register to comment.