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

kapilkapil Members
edited November -1 in Sahi - Open Source
HI, sumitra

kapil here, here i am posting command prompt message s for your reference.


C:\sahi_20110719\sahi\userdata\bin>SET SAHI_HOME=..\..

C:\sahi_20110719\sahi\userdata\bin>SET SAHI_USERDATA_DIR=..

C:\sahi_20110719\sahi\userdata\bin>SET SAHI_EXT_CLASS_PATH=

C:\sahi_20110719\sahi\userdata\bin>CALL ..\..\bin\dashboard.bat
SAHI_HOME: ..\..
SAHI_USERDATA_DIR: ..
SAHI_EXT_CLASS_PATH:
Sahi properties file = C:\sahi_20110719\sahi\config\sahi.properties
Sahi user properties file = C:\sahi_20110719\sahi\userdata\config\userdata.prope
rties
>>>> Sahi started. Listening on port: 9999
>>>> Configure your browser to use this server and port as its proxy
>>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Cont
roller
Reading browser types from: C:\sahi_20110719\sahi\userdata\config\browser_types.
xml
Firefox 4 was not found at C:\Program Files\Mozilla Firefox 4.0 Beta 7\firefox.e
xe
Safari was not found at C:\Program Files\Safari\Safari.exe
Chrome was not found at C:\Users\kkinikar\AppData\Local\Google\Chrome\Applicatio
n\chrome.exe
Opera was not found at C:\Program Files\Opera\opera.exe
C:\Program Files\Internet Explorer\iexplore.exe -noframemerging http://sahi.exam
ple.com/_s_/dyn/Driver_initialized
Aug 2, 2011 10:52:53 AM net.sf.sahi.ssl.SSLHelper getKeyManagerFactoryForRemoteF
etch
INFO: No SSL Client Cert specified
Aug 2, 2011 10:53:19 AM net.sf.sahi.config.SahiAuthenticator getPasswordAuthenti
cation
INFO: getRequestingProtocol() = http
Aug 2, 2011 10:53:19 AM net.sf.sahi.config.SahiAuthenticator getPasswordAuthenti
cation
INFO: realm=ITSIWC1.com; getRequestingScheme()=basic
Aug 2, 2011 10:53:19 AM net.sf.sahi.RemoteRequestProcessor process401
INFO: wwwAuthenticate: Basic realm="ITSIWC1.com"
Aug 2, 2011 10:53:19 AM net.sf.sahi.RemoteRequestProcessor process401
INFO: scheme=basic; realm=ITSIWC1.com
Aug 2, 2011 10:53:30 AM net.sf.sahi.session.Session addRequestCredentials
INFO: >>> Credentials added: ITSIWC1.com itsiwc1\mdurge
Aug 2, 2011 10:53:30 AM net.sf.sahi.config.SahiAuthenticator getPasswordAuthenti
cation
INFO: getRequestingProtocol() = http
Aug 2, 2011 10:53:30 AM net.sf.sahi.config.SahiAuthenticator getPasswordAuthenti
cation
INFO: realm=ITSIWC1.com; getRequestingScheme()=basic
Aug 2, 2011 10:53:30 AM net.sf.sahi.config.SahiAuthenticator getPasswordAuthenti
cation
INFO: Using credentials supplied: realm=ITSIWC1.com; username=itsiwc1\mdurge;
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
Aug 2, 2011 11:16:18 AM net.sf.sahi.command.FileUpload appendFiles
INFO: Uploading: fileName = C:\fileupload\Test1.txt resolved to C:\fileupload\Te
st1.txt
url: http://www.test.com/fu/default.aspx?FileID=12
command: FileUpload_appendFiles
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Calling downloadFile
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: http://www.test.com/fu/default.aspx?FileID=12
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadURL = false
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: response.isAttachment() = false
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: contentTypeHeader = application/octet-stream
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadContentType = true
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Content-Disposition=null
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor save
INFO: Downloading sahi_9bb060c800e1604d5a0897a0a080777eba9f__default.aspx to tem
p directory: C:\sahi_20110719\sahi\userdata\temp\download
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Setting download_lastFile = default.aspx
Aug 2, 2011 11:16:21 AM net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Session Id: sahi_9bb060c800e1604d5a0897a0a080777eba9f
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
Aug 2, 2011 11:17:46 AM net.sf.sahi.command.FileUpload appendFiles
INFO: Uploading: fileName = C:\fileupload\Test1.txt resolved to C:\fileupload\Te
st1.txt
url: http://www.test.com/fu/default.aspx?FileID=13
command: FileUpload_appendFiles
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Calling downloadFile
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: http://www.test.com/fu/default.aspx?FileID=13
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadURL = false
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: response.isAttachment() = false
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: contentTypeHeader = application/octet-stream
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: downloadContentType = true
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor processHttp
INFO: Content-Disposition=null
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor save
INFO: Downloading sahi_9bb060c800e1604d5a0897a0a080777eba9f__default.aspx to tem
p directory: C:\sahi_20110719\sahi\userdata\temp\download
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Setting download_lastFile = default.aspx
Aug 2, 2011 11:17:46 AM net.sf.sahi.RemoteRequestProcessor downloadFile
INFO: Session Id: sahi_9bb060c800e1604d5a0897a0a080777eba9f
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
Aug 2, 2011 11:20:56 AM net.sf.sahi.command.FileUpload appendFiles
INFO: Uploading: fileName = C:\Users\Public\Pictures\Sample Pictures\Desert.jpg
resolved to C:\Users\Public\Pictures\Sample Pictures\Desert.jpg
url: http://www.test.com/fu/default.aspx?FileID=17
command: FileUpload_appendFiles
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
url: http://www.test.com/fu/default.aspx
command: FileUpload_appendFiles
Aug 2, 2011 11:21:37 AM net.sf.sahi.command.FileUpload appendFiles
INFO: Uploading: fileName = C:\Users\Public\Pictures\Sample Pictures\Penguins.jp
g resolved to C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg
url: http://www.test.com/fu/default.aspx?FileID=18
command: FileUpload_appendFiles
Rhino lib:Step >_sahi._setFile(_sahi._file("filMyFile"), "C:\\Users\\Public\\Pic
tures\\Sample Pictures\\Desert.jpg");< did not complete in 150 seconds.
url: http://development.itsiwc1.com/AP.InterfaceLayer/APInvoice/AddEditInvoiceDo
cument.aspx?mode=Add&ProjectNumber=00118.0200&InvoiceId=5338&InvoiceNumber=787&I
nvoiceDocumentId=6
command: FileUpload_appendFiles
Aug 2, 2011 11:41:06 AM net.sf.sahi.command.CommandExecuter execute
WARNING: commandClass = >net.sf.sahi.command.Player< commandMethod = >hasErrors<

Aug 2, 2011 11:41:06 AM net.sf.sahi.command.CommandExecuter execute
WARNING: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:55)
at net.sf.sahi.LocalRequestProcessor.handleDyn(LocalRequestProcessor.jav
a:67)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProces
sor.java:40)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:209)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:86)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.sf.sahi.command.Player.hasErrors(Player.java:269)
... 12 more

Still my application can not upload file via sahi controller...

this is my latest script.

_click(_cell("Enter Invoice"));
_click(_button("dbcPurchaseOrder_ulbSearchButton"));
_setSelected(_select("dbcPurchaseOrder\$ulbDropDown"), "0011806");
_setValue(_textbox("txtInvoiceNumber"), "8903");
_setValue(_textbox("dtpInvoiceDate"), "07/28/2011");
_setValue(_textbox("dtpDateReceived"), "07/25/2011");
_setValue(_textbox("txtInvoiceAmount"), "90");
_setValue(_textarea("txtInvoiceDescription"), "iyuiyiuyiyuiyi");
_click(_submit("Edit"));
_setValue(_textbox("dtgrdTaskDistribution\$ctl02\$txtDistribution"), "90.00");
_click(_submit("Update"));
_click(_submit("Upload New Document"));
_setSelected(_select("drpdwnDoucmentType"), "Approval Document");
_setFile(_file("fileUploadInvoiceFile"), "C:\\sahi_20110719\\sahi\\test.txt");
if (_isIE()){
_call(_file("fileUploadInvoiceFile").outerHTML = _file("fileUploadInvoiceFile").outerHTML.replace("type=\"file\"", "type=text"));
}else{
_call(_file("fileUploadInvoiceFile").type = "text");
}
// Set the value into the textbox
_setValue(_textbox("fileUploadInvoiceFile"), "C:\\sahi_20110719\\sahi\\test.txt");
_click(_submit("Save"));
_click(_submit("Upload New Document"));
_setValue(_textbox("txtDocument"), "tyty");
_setFile(_file("fileUploadInvoiceFile"), "");
_setFile(_file("fileUploadInvoiceFile"), "C:\\Users\\kkinikar\\Desktop\\comand.txt");
if (_isIE()){
_call(_file("fileUploadInvoiceFile").outerHTML = _file("fileUploadInvoiceFile").outerHTML.replace("type=\"file\"", "type=text"));
}else{
_call(_file("fileUploadInvoiceFile").type = "text");
}
// Set the value into the textbox
_setValue(_textbox("fileUploadInvoiceFile"), "C:\\Users\\kkinikar\\Desktop\\comand.txt");
_click(_submit("Save"));


i discussed this issue with Ms. Dipti kulkarni in online meeting...
but there is no outcome .... so, plese look into this matter so that i can proceed further....

hopping possitive responce from your side.....

Regards,

Kapil....

my office outlook id had a problem ....

Comments

  • kapilkapil Members
    plese point out only itsi portal messages, rest of them working properly....

    regards,

    kapil
  • OldikOldik Members
    Kapil, have you already solved this bug?
  • Hi Oldik,

    Could you please let me know where exactly you are facing problem?

    Are you getting any error while uploading a file?

    Kindly be specific about the issue with script.

    Regards
    Sumitra
  • OldikOldik Members
    edited August 2011
    Hi Sumitra,
    thank you for interest. I tried to upload a file with this code

    _setFile(_file("pt1:content:r1:1:pt1:if1"),"vehicle_import_2.xml");
    _call(_file("pt1:content:r1:1:pt1:if1").type = "text");
    _setValue(_textbox("pt1:content:r1:1:pt1:if1"), "C:\\App\\sahi35\\userdata\\vehicle_import_2.xml");

    acording to this thread: h ttp://sahi.co.in/forums/viewtopic.php?id=1647

    The name and the path to the file is corectly write to the textfield, it seems that it's uploaded, but the next page, which in manually test appears after uploading, now doesn't appear and in the database, there is no record.
    I tried put the third parametr to the _setFile() function - i found the script name in action atribut of form tag, but it doesn't help.
    Maybe it would be some problem with validation or proxy server, I don't know, I tried everything, but nothing function.
  • narayannarayan Administrators
    Hi Oldik,

    Please send an email to support@sahi.co.in . We will set up a desktop sharing session to see how to resolve your problem.

    Regards,
    Narayan
Sign In or Register to comment.