It seems there is a bug with java.util.Robot
always using numpad [arrow] keys, just try alt+numpad4 or numpad6 manually. I couldn't find the original bug, here are some links:
- https://bugs.openjdk.java.net/browse/JDK-4838497
- Java awt Robot still cant press non-numpad arrows on windows?
As a work-around, you'd try to remove focus from the address bar, the following worked for me:
robot.keyPress(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_ALT);
robot.delay(1); // seems to be required for the event to be registered
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_ALT);