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 upload a file using java

lshankar_mcalshankar_mca Members
edited November -1 in Sahi - Open Source
Hi Narayan,

I am trying to upload a file using Sahi JAVA. But I am failing to upload a file.
Following is my code.

browser.button("Attach").click();
Thread.sleep(4000);
browser.textbox("txttitle").setValue("Test");
//browser.execute("_sahi._setFile(_sahi._file('image'), 'scripts/demo/uploadme.txt')");
browser.file("image").setFile("ss.txt");
browser.submit("upload").click();
System.out.println(browser.lastAlert());

I am getting following error: Please select a file to upload.

Please help me how to upload a file using the java.

Regards,
Shankar L

Comments

  • Please help me how to upload a file using the Sahi JAVA API.

    Regards,
    Shankar L
Sign In or Register to comment.