I use this to accept or cancel firefox download or open file dialog (damn firefox y u not automate?)
public class CloseConfirmPopUp implements Runnable
{
@Override
public void run()
{
try
{
Robot robot = new Robot();
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
catch(AWTException e)
{
e.printStackTrace();
}
return;
}
}
public class CloseCancelPopUp implements Runnable
{
public void run()
{
try
{
Robot robot = new Robot();
robot.delay(10000);
robot.keyPress(KeyEvent.VK_CANCEL);
}
catch(AWTException e)
{
e.printStackTrace();
}
return;
}
}