18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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 with disabled button
Hi,
I am testing on a webpage that has a field where the user must choose a file to upload. Once a file is chosen, a Next button is enabled. The Next button is disabled until the file is chosen.
I have searched the forums and found possible solutions, but they do not work in my case. I have tried setting the file with the _setFile function, but the 'Next' button does not become enabled
_setFile(_file("file"), "c:\\Automation\\Temp\\NNC-65.csv");
I have also tried setting the file and then using the workaround to set the value, but this also does not work
_setFile(_file("file"), "myFile.csv");
_call(_file("file").outerHTML = _file("file").outerHTML.replace(/type=file/, "type=text"));
_setValue(_file("file"), "myFile.csv");
It seems that the fix for my problem is to enable the next button after I issue the _setFile command. Is this possible with Sahi?
I've tried the following but none seem to work:
_call(document.getElementById("Next >").disabled = false);
_call(_button("Next >").disabled = false);
I can see with the 'List Properties' that isDisabled is still set to true.
Thanks for your help!
I am testing on a webpage that has a field where the user must choose a file to upload. Once a file is chosen, a Next button is enabled. The Next button is disabled until the file is chosen.
I have searched the forums and found possible solutions, but they do not work in my case. I have tried setting the file with the _setFile function, but the 'Next' button does not become enabled
_setFile(_file("file"), "c:\\Automation\\Temp\\NNC-65.csv");
I have also tried setting the file and then using the workaround to set the value, but this also does not work
_setFile(_file("file"), "myFile.csv");
_call(_file("file").outerHTML = _file("file").outerHTML.replace(/type=file/, "type=text"));
_setValue(_file("file"), "myFile.csv");
It seems that the fix for my problem is to enable the next button after I issue the _setFile command. Is this possible with Sahi?
I've tried the following but none seem to work:
_call(document.getElementById("Next >").disabled = false);
_call(_button("Next >").disabled = false);
I can see with the 'List Properties' that isDisabled is still set to true.
Thanks for your help!
This discussion has been closed.
Comments
_setFile(_file("file"), "C:\\Temp\\myFile.csv");
if (_isIE()){
_call(_file("file").outerHTML = _file("file").outerHTML.replace(/type=file/, "type=text"));
}else{
_call(_file("file").type = "text");
}
_setValue(_textbox("file"), "myFile.csv");
Anyone have a solution that works with Internet Explorer as well? Thanks!
What version of IE are you using? Check if you are getting any error on Sahi console?
Can you post the contents of <browser_types> for IE by clicking on configure on the Dashboard.
Regards
Sumitra
1) The _file("file") is being renamed to _textbox("x-auto-2061"). When I try and run the next line of '_setValue(_textbox("file"), "myFile.csv");', this fails because 'The first parameter passed to _setValue was not found on the browser'.
2) I then tried _setValue(_textbox("x-auto-2061"), "myFile.csv"); - but this also fails with the message '[Exception] [object Error]'
Here is the information of the <browser_types> for IE:
<browserType>
<name>ie</name>
<displayName>IE 9</displayName>
<icon>ie.png</icon>
<path>$ProgramFiles (x86)\Internet Explorer\iexplore.exe</path>
<options>-noframemerging</options>
<processName>iexplore.exe</processName>
<useSystemProxy>true</useSystemProxy>
<capacity>5</capacity>
</browserType>
I am not sure how to proceed.
Can you try using only
_setFile(_file("file"), "C:\\Temp\\myFile.csv");
Check if you are facing any problem.
Regards
Sumitra
Thank you!
Try this.
Obtain the identifier for the textbox next to the browse button.
Now, in your if(_isIE()) condition,
Add,
This should work.
Regards,
dkulkarni
Thanks for your help!