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.

Unable to navigate to the next page after file upload

seresere Members
edited November -1 in Sahi - Open Source
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

  • narayannarayan Administrators
    Hi Sere,

    Does it show any errors on Sahi's console (where you start the proxy from)?

    Regards,
    Narayan
  • seresere Members
    Hi 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
  • hi Sere

    try _setFile("yourFileField", "youUploadFile","yourSubmitURL");
  • seresere Members
    I tried this.The play back shows succesfull but still the next page is not displayed on the browser.Blank page is displayed instead.
    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
  • could you pase your code here?
  • narayannarayan Administrators
    Hi Sere,

    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
  • seresere Members
    No the file uploaded is a jpeg image and a flv video.I am unable to post the code as it has links and this page do not allow posting links or email address.
  • beesmanbeesman Members
    edited August 2010
    use BBCODE code tag
    [ code ] here your source [ / code ]
  • seresere Members
    I tried agian.Still the error message reads as new members cannot post links or email..pls help.
  • beesmanbeesman Members
    edited August 2010
    when i am a newer please place space in character
    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
  • seresere Members
    _setValue(_textbox("frmLogin:E-mail"), "t@t.com");
    _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 :* Option 1 :* Option 2 :* Option 3 : Option 4 : Option 5 :[1]"));
    _click(_imageSubmitButton("frmAddQuestion:add"));
    _click(_imageSubmitButton("frmAddQuestion:submitBtn"));
  • beesmanbeesman Members
    edited August 2010
    delete all script that value is ""
    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");
  • seresere Members
    edited August 2010
    Tried this..still its not working...The issue is not with file upload.During play back,after uploading file the script stops running and do not move to the next page.[sahi controller log says"Script did not start within 130 seconds].
Sign In or Register to comment.