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.
Unable to navigate to the next page after file upload
In case of scripts where file upload is involved,during play back,the script stops running after the file upload page and do not navigate to the next page.
Comments
Does it show any errors on Sahi's console (where you start the proxy from)?
Regards,
Narayan
The following error in console:
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:52)
at net.sf.sahi.command.MockResponder.getResponse(MockResponder.java:66)
at net.sf.sahi.ProxyProcessor.handleDifferently(ProxyProcessor.java:157)
at net.sf.sahi.ProxyProcessor.processAsProxy(ProxyProcessor.java:137)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:93)
at java.lang.Thread.run(Unknown Source)
Caused by: net.sf.sahi.util.FileIsDirectoryException
at net.sf.sahi.util.Utils.readFile(Utils.java:159)
at net.sf.sahi.util.Utils.readFile(Utils.java:146)
at net.sf.sahi.command.FileUpload.appendFiles(FileUpload.java:83)
... 10 more
Sere
try _setFile("yourFileField", "youUploadFile","yourSubmitURL");
sahi console shows follwoing error:
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:52)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProces
sor.java:43)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:179)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:86)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.sf.sahi.playback.ScriptFactory.getScript(ScriptFactory.java:25)
at net.sf.sahi.playback.ScriptFactory.getScript(ScriptFactory.java:32)
at net.sf.sahi.command.Player.setScript(Player.java:99)
at net.sf.sahi.command.Player.resetScript(Player.java:96)
... 9 more
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:52)
at net.sf.sahi.command.MockResponder.getResponse(MockResponder.java:66)
at net.sf.sahi.ProxyProcessor.handleDifferently(ProxyProcessor.java:157)
at net.sf.sahi.ProxyProcessor.processAsProxy(ProxyProcessor.java:137)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:93)
at java.lang.Thread.run(Unknown Source)
Caused by: net.sf.sahi.util.FileIsDirectoryException
at net.sf.sahi.util.Utils.readFile(Utils.java:159)
at net.sf.sahi.util.Utils.readFile(Utils.java:146)
at net.sf.sahi.command.FileUpload.appendFiles(FileUpload.java:83)
... 10 more
From your first error, it looks like the file path you have provided in your script actually points to a folder and not to a file.
Regards,
Narayan
[ code ] here your source [ / code ]
h t t p : / / instead of http://
beesman @ sahi.co.in instead of beesman@sahi.co.in
or
htt*p*:* /* / instead of http://
beesman*@*sahi.co.in instead of beesman@sahi.co.in
_setValue(_password("frmLogin:Password"), "test111");
_click(_imageSubmitButton("frmLogin:cmdSubmit"));
_click(_link("Create an Ad for a Campaign"));
_setSelected(_select("frmCreateAd:sltCampaign"), "PNR");
_setValue(_textbox("frmCreateAd:AdvertisementName"), "ad_aug3_static");
_click(_button("..."));
_click(_link("3"));
_click(_button("...[1]"));
_click(_link("31[1]"));
_setFile(_file("frmCreateAd:Thumbnail"), "");
_setFile(_file("frmCreateAd:Thumbnail"), "C:\\sahi\\userdata\\Ad images\\lg mobile.jpeg","h t t p : / / www. url . com");
_wait(10000);
_setFile(_file("frmCreateAd:Video"), "");
_setFile(_file("frmCreateAd:Video"), "C:\\sahi\\userdata\\Ad images\\IR1_TEST_DONOTSELECT.3GP","h t t p: / / www . url . com");
_wait(10000);
_setFile(_file("frmCreateAd:SmallCoupon"), "");
_setFile(_file("frmCreateAd:SmallCoupon"), "C:\\sahi\\userdata\\Ad images\\Coupn Thumbnail 120x91.PNG","h t t p : / / www . url . com");
_wait(10000);
_setFile(_file("frmCreateAd:LargeCoupon"), "");
_setFile(_file("frmCreateAd:LargeCoupon"), "C:\\sahi\\userdata\\Ad images\\Coupn 449x313.jpg","h t t p : / / www . url . com");
_wait(10000);
_setValue(_textbox("frmCreateAd:CouponText"), "fdafafa");
_click(_button("...[2]"));
_click(_link("31[2]"));
_setValue(_textbox("frmCreateAd:CouponUrl"), "h t t p : / / t . com");
_click(_imageSubmitButton("frmCreateAd:_idJsp33"));
_wait(6000000);
_setValue(_textbox("frmAddQuestion:Question"), "q1");
_setValue(_textbox("frmAddQuestion:Option"), "a1");
_setValue(_textbox("frmAddQuestion:option2"), "a2");
_click(_div("Campaign Questions QuestionsView OptionsDelete Question
_click(_imageSubmitButton("frmAddQuestion:add"));
_click(_imageSubmitButton("frmAddQuestion:submitBtn"));
like _setFile(_file("xxxxx"), "");
not
_setFile(_file("frmCreateAd:Thumbnail"), "");
_setFile(_file("frmCreateAd:Thumbnail"), "C:\\sahi\\userdata\\Ad images\\lg mobile.jpeg","h t t p : / / www. url . com");
but
_setFile(_file("frmCreateAd:Thumbnail"), "C:\\sahi\\userdata\\Ad images\\lg mobile.jpeg","h t t p : / / www. url . com");