Right now automation in java using java.awt.Robot class have several
constraints and users have to specify arbitary delays to overcome
these problems and because of these delays testcases become less
portable across different platforms.
Following are the constrainsts which can I point out:
1) If you want to click the mouse than there must be call to mousePress
& mouseRelease api with some specific amount of delay in between,
There should be some way to get the delay from some API instead of
user putting some arbitary value. Maybe attribute can be added in
Desktop Properties which can be accessed by Toolkit. for e.g
Toolkit.getDefaultToolkit().getDesktopProperty("awt.mouse.clickDelay");
Optionally a API mouseClick can be added in Robot class which wraps
all these details from naive user.
something like
public void mouseClick(int buttons) {
mousePress(buttons);
// Give here OS specific delay
mouseRelease(buttons);
}
2) Above case applies for double click of mouse also.
3) Similarly there should be some property/api to get following
keyboard desktop property.
- Keyboard repeat delay - If you keep the keyboard key pressed than this is
the time after which it will repeat the keyPress event
- Keyboard repeat rate - Rate at which character is repeated when key is
holded for a while.
Optionally a wrapper can be provided in Robot class which types the key
i.e instead of user making call to keyPress and keyRelease, user just need
to make one call.
something like
public void keyType(int keycode) {
keyPress(keycode);
// Give here OS specific delay
keyRelease(keycode);
}
###@###.### 2003-12-11
constraints and users have to specify arbitary delays to overcome
these problems and because of these delays testcases become less
portable across different platforms.
Following are the constrainsts which can I point out:
1) If you want to click the mouse than there must be call to mousePress
& mouseRelease api with some specific amount of delay in between,
There should be some way to get the delay from some API instead of
user putting some arbitary value. Maybe attribute can be added in
Desktop Properties which can be accessed by Toolkit. for e.g
Toolkit.getDefaultToolkit().getDesktopProperty("awt.mouse.clickDelay");
Optionally a API mouseClick can be added in Robot class which wraps
all these details from naive user.
something like
public void mouseClick(int buttons) {
mousePress(buttons);
// Give here OS specific delay
mouseRelease(buttons);
}
2) Above case applies for double click of mouse also.
3) Similarly there should be some property/api to get following
keyboard desktop property.
- Keyboard repeat delay - If you keep the keyboard key pressed than this is
the time after which it will repeat the keyPress event
- Keyboard repeat rate - Rate at which character is repeated when key is
holded for a while.
Optionally a wrapper can be provided in Robot class which types the key
i.e instead of user making call to keyPress and keyRelease, user just need
to make one call.
something like
public void keyType(int keycode) {
keyPress(keycode);
// Give here OS specific delay
keyRelease(keycode);
}
###@###.### 2003-12-11
- relates to
-
JDK-4817479 Robot is generating multiple key events against single keystroke on Redhat Linux
- Closed