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 and Java Robot

tower120tower120 Members
edited November -1 in Sahi - Open Source
Hi!

We have a complex file upload system (cant input my url here, your forum not allow this) yellow button "Upload additional images". Your implementation of _setFile is not suitable here (as I understand. Fix me if I mistaken).

So - we decided to use Java AWT Robot for this purpose. The question is: how to include java.awt.Robot? :) In Rhino we have importPackage, but seems not work here. Here is my code (just double-click in 30,30):

importPackage(java.awt.Robot);
importPackage(java.awt.event.InputEvent);

var robot = new Robot(); //input simulation class

robot.mouseMove(30, 30);

robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);

In result - ReferenceError: "importPackage" is not defined

Please, advise.
Thank you.
Sign In or Register to comment.